#!/usr/bin/env python

import unittest
import numpy as np

from provider import rotate_point_cloud_by_angle

class Testing(unittest.TestCase):
    def test_check_rotation(self):
        valid_matrix = np.random.rand([1,2,3], [4,5,6], [7,8,9])
        output = rotate_point_cloud_by_angle(valid_matrix)
        expected_output = np.array(array([[ 0.02821476,  2. , -3.1621518 ], [ 5.073585  ,  5.,  5.1243277 ], [11.075927  ,  8.,  2.7062616 ]], dtype=float32))
        self.assertAlmostEqual(output, expected_output, places = 3)

    def test_check_invalid_rotation(self):
        invalid_matrix = str(789)
        with self.assertRaises(AssertionError):
            rotate_point_cloud_by_angle(invalid_matrix, 45)

if __name__ == "__main__":
    unittest.main()
