import unittest
converter = __import__("obj-to-sm-conversion")

model = """
# Blender v2.71 (sub 0) OBJ File:
# www.blender.org
mtllib object.mtl
o Cube
v 1.000000 -1.000000 -1.000000
v 1.000000 -1.000000 1.000000
v -1.000000 -1.000000 1.000000
v -1.000000 -1.000000 -1.000000
v 1.000000 1.000000 -0.999999
v 0.999999 1.000000 1.000001
v -1.000000 1.000000 1.000000
v -1.000000 1.000000 -1.000000
v 0.493105 -0.493106 2.246419
v -0.493106 -0.493106 2.246419
v 0.493105 0.493105 2.246419
v -0.493106 0.493105 2.246419
v 0.493105 -0.493106 3.738037
v -0.493106 -0.493106 3.738037
v 0.493104 0.493105 3.738037
v -0.493107 0.493105 3.738037
v 0.493105 -0.493106 4.284467
v -0.493107 -0.493106 4.284467
v 0.493104 0.493105 4.284468
v -0.493107 0.493105 4.284467
v 0.493104 1.012896 3.738037
v -0.493107 1.012896 3.738037
v 0.493104 1.343554 4.284468
v -0.493107 1.343554 4.284467
v 0.493105 1.845343 3.234304
v -0.493106 1.845343 3.234304
v 0.493105 2.176001 3.780735
v -0.493106 2.176001 3.780734
v 0.570207 -1.571936 -0.570207
v 0.570207 -1.571936 0.570207
v -0.570207 -1.571936 0.570207
v -0.570207 -1.571936 -0.570208
v 0.570207 -3.115134 -0.570207
v 0.570207 -3.115134 0.570207
v -0.570207 -3.115134 0.570207
v -0.570207 -3.115134 -0.570208
vn -0.799400 -0.600800 -0.000000
vn 0.000000 1.000000 0.000000
vn 1.000000 -0.000000 0.000000
vn -0.000000 0.926300 0.376700
vn -1.000000 -0.000000 -0.000000
vn 0.000000 0.000000 -1.000000
vn -0.926300 -0.000000 0.376700
vn 0.926300 0.000000 0.376700
vn 0.000000 -0.926300 0.376700
vn 0.000000 -1.000000 0.000000
vn -0.000000 -0.000000 1.000000
vn 0.000000 0.855600 -0.517700
vn -0.000000 0.517700 0.855600
vn 0.000000 -0.517700 -0.855600
vn -0.000000 -0.600800 0.799400
vn 0.000000 -0.600800 -0.799400
vn 0.799400 -0.600800 0.000000
usemtl Material
s off
f 4//1 32//1 31//1
f 8//2 7//2 6//2
f 1//3 5//3 6//3
f 7//4 12//4 11//4
f 7//5 8//5 4//5
f 1//6 4//6 8//6
f 12//2 16//2 15//2
f 7//7 3//7 10//7
f 2//8 6//8 11//8
f 2//9 9//9 10//9
f 16//5 20//5 24//5
f 12//5 10//5 14//5
f 9//3 11//3 15//3
f 9//10 13//10 14//10
f 17//11 19//11 20//11
f 16//5 14//5 18//5
f 15//3 19//3 17//3
f 13//10 17//10 18//10
f 22//5 24//5 28//5
f 15//3 21//3 23//3
f 19//11 23//11 24//11
f 16//6 22//6 21//6
f 26//12 28//12 27//12
f 23//3 21//3 25//3
f 23//13 27//13 28//13
f 22//14 26//14 25//14
f 32//5 36//5 35//5
f 3//15 31//15 30//15
f 1//16 29//16 32//16
f 2//17 30//17 29//17
f 34//10 35//10 36//10
f 31//11 35//11 34//11
f 29//6 33//6 36//6
f 29//3 30//3 34//3
f 3//1 4//1 31//1
f 5//2 8//2 6//2
f 2//3 1//3 6//3
f 6//4 7//4 11//4
f 3//5 7//5 4//5
f 5//6 1//6 8//6
f 11//2 12//2 15//2
f 12//7 7//7 10//7
f 9//8 2//8 11//8
f 3//9 2//9 10//9
f 22//5 16//5 24//5
f 16//5 12//5 14//5
f 13//3 9//3 15//3
f 10//10 9//10 14//10
f 18//11 17//11 20//11
f 20//5 16//5 18//5
f 13//3 15//3 17//3
f 14//10 13//10 18//10
f 26//5 22//5 28//5
f 19//3 15//3 23//3
f 20//11 19//11 24//11
f 15//6 16//6 21//6
f 25//12 26//12 27//12
f 27//3 23//3 25//3
f 24//13 23//13 28//13
f 21//14 22//14 25//14
f 31//5 32//5 35//5
f 2//15 3//15 30//15
f 4//16 1//16 32//16
f 1//17 2//17 29//17
f 33//10 34//10 36//10
f 30//11 31//11 34//11
f 32//6 29//6 36//6
f 33//3 29//3 34//3
"""

class TestConvertFunctions(unittest.TestCase):

    def test_conversion(self):
        global model
        (format, faces, vertexes, normals, texture) = converter.convert_to_objects(model)

        self.assertEqual(len(faces), 68)
        self.assertEqual(len(vertexes), 36)
        self.assertEqual(len(normals), 17)
        self.assertEqual(len(texture), 0)
        self.assertEqual(format, 'vn')

        return 0
