@@ -26,32 +26,34 @@ def test_init(self):
2626
2727 # Make sure that the number of elements in the MaterialType enum matches
2828 # the number of elements in the MaterialDensity::materials map.
29- self .assertEqual (ignition .math .MaterialType_UNKNOWN_MATERIAL , len (mats ))
29+ self .assertEqual (ignition .math .MaterialType .UNKNOWN_MATERIAL ,
30+ ignition .math .MaterialType (len (mats )))
3031
3132 # Iterate over each element in the enum. Check the that enum value
3233 # matches the type value in the mats map.
33- for i in range (ignition .math .MaterialType_UNKNOWN_MATERIAL ):
34+ for i in range (ignition .math .MaterialType . UNKNOWN_MATERIAL ):
3435 # Get the type of the material for MaterialType i.
35- self .assertEqual (i , next (iter (mats .find (i )))[1 ].type ())
36+ self .assertEqual (ignition .math .MaterialType (i ),
37+ mats [ignition .math .MaterialType (i )].type ())
3638
3739 # The name should not be empty
38- self .assertTrue (next ( iter ( mats . find (i )))[ 1 ].name ())
40+ self .assertTrue (mats [ ignition . math . MaterialType (i )].name ())
3941
4042 # The density should be less than the max double value and greater than
4143 # zero.
42- self .assertLess (next ( iter ( mats . find (i )))[ 1 ].density (), sys .float_info .max )
43- self .assertGreater (next ( iter ( mats . find (i )))[ 1 ].density (), 0.0 )
44+ self .assertLess (mats [ ignition . math . MaterialType (i )].density (), sys .float_info .max )
45+ self .assertGreater (mats [ ignition . math . MaterialType (i )].density (), 0.0 )
4446
45- malicious = ignition .math .Material (42 )
47+ malicious = ignition .math .Material (ignition . math . MaterialType ( 42 ) )
4648 self .assertEqual (- 1.0 , malicious .density ())
4749 self .assertEqual ('' , malicious .name ())
4850
4951 byDensity = ignition .math .Material (42.2 )
5052 self .assertEqual (42.2 , byDensity .density ())
51- self .assertEqual (ignition .math .MaterialType_UNKNOWN_MATERIAL , byDensity .type ())
53+ self .assertEqual (ignition .math .MaterialType . UNKNOWN_MATERIAL , byDensity .type ())
5254
5355 def test_comparison (self ):
54- aluminum = ignition .math .Material (ignition .math .MaterialType_ALUMINUM )
56+ aluminum = ignition .math .Material (ignition .math .MaterialType . ALUMINUM )
5557
5658 modified = ignition .math .Material (aluminum )
5759 self .assertEqual (modified , aluminum )
@@ -62,14 +64,14 @@ def test_comparison(self):
6264 modified = ignition .math .Material (aluminum )
6365 self .assertEqual (modified , aluminum )
6466
65- modified .set_type (ignition .math .MaterialType_PINE )
67+ modified .set_type (ignition .math .MaterialType . PINE )
6668 self .assertNotEqual (modified , aluminum )
6769
6870 def test_accessors (self ):
6971
7072 mat = ignition .math .Material ("Aluminum" )
7173 mat1 = ignition .math .Material ("aluminum" )
72- mat2 = ignition .math .Material (ignition .math .MaterialType_ALUMINUM )
74+ mat2 = ignition .math .Material (ignition .math .MaterialType . ALUMINUM )
7375 mat3 = ignition .math .Material (mat2 )
7476
7577 self .assertAlmostEqual (2700.0 , mat .density ())
@@ -86,23 +88,23 @@ def test_accessors(self):
8688
8789 mat = ignition .math .Material ("Notfoundium" )
8890 self .assertGreater (0.0 , mat .density ())
89- self .assertEqual (ignition .math .MaterialType_UNKNOWN_MATERIAL ,
91+ self .assertEqual (ignition .math .MaterialType . UNKNOWN_MATERIAL ,
9092 mat .type ())
9193 self .assertFalse (mat .name ())
9294
9395 material = ignition .math .Material ()
9496 material .set_to_nearest_density (19300.0 )
95- self .assertEqual (ignition .math .MaterialType_TUNGSTEN , material .type ())
97+ self .assertEqual (ignition .math .MaterialType . TUNGSTEN , material .type ())
9698 self .assertAlmostEqual (19300.0 , material .density ())
9799
98100 material = ignition .math .Material ()
99101 material .set_to_nearest_density (1001001.001 , 1e-3 )
100- self .assertEqual (ignition .math .MaterialType_UNKNOWN_MATERIAL ,
102+ self .assertEqual (ignition .math .MaterialType . UNKNOWN_MATERIAL ,
101103 material .type ())
102104 self .assertGreater (0.0 , material .density ())
103105 material = ignition .math .Material ()
104106 material .set_to_nearest_density (1001001.001 )
105- self .assertEqual (ignition .math .MaterialType_TUNGSTEN , material .type ())
107+ self .assertEqual (ignition .math .MaterialType . TUNGSTEN , material .type ())
106108 self .assertAlmostEqual (19300 , material .density ())
107109
108110
0 commit comments