4 #include <dali/public-api/dali-core.h>
5 #include <dali-test-suite-utils.h>
9 void utc_dali_degree_startup(void)
11 test_return_value = TET_UNDEF;
14 void utc_dali_degree_cleanup(void)
16 test_return_value = TET_PASS;
20 // Positive test case for constructors
21 int UtcDaliDegreeConstructors01(void)
23 TestApplication application;
25 // Default constructor, does not initialise the value
26 Degree degree0( 0.0f );
28 // Test assignment operator
29 degree0 = Degree(180.0f);
30 DALI_TEST_EQUALS( degree0.degree, 180.0f, 0.001f, TEST_LOCATION );
32 // Constructor from float value
33 Degree degree1( 180.0f );
34 DALI_TEST_EQUALS( degree1.degree, 180.0f, 0.001f, TEST_LOCATION );
36 // Constructor from a Radian
37 Degree degree2( Radian( Math::PI ) );
38 DALI_TEST_EQUALS( degree2.degree, 180.0f, 0.001f, TEST_LOCATION );
43 // Positive test case for comparison
44 int UtcDaliDegreeComparison01(void)
46 TestApplication application;
48 // Comparison between degrees
49 Degree degree0( 90.0f );
50 Degree degree1( 90.0f );
51 Degree degree2( 180.0f );
53 DALI_TEST_CHECK( degree0 == degree1 );
54 DALI_TEST_CHECK( degree0 != degree2 );
56 // Comparison between radian to degree
57 Degree degree3( 180.0f );
58 Degree degree4( 90.0f );
59 Radian radian0( Math::PI );
61 DALI_TEST_CHECK( degree3 == Degree(radian0) );
62 DALI_TEST_CHECK( degree4 != Degree(radian0) );
64 // Comparison with float
65 Degree degree5( 90.0f );
67 DALI_TEST_CHECK( degree5.degree == 90.0f );
68 DALI_TEST_CHECK( degree5.degree != 180.0f );
73 int UtcDaliDegreeOperatorEquals(void)
75 TestApplication application;
81 DALI_TEST_EQUALS(a == a, true, TEST_LOCATION);
82 DALI_TEST_EQUALS(a == b, true, TEST_LOCATION);
83 DALI_TEST_EQUALS(a == c, false, TEST_LOCATION);
87 int UtcDaliDegreeOperatorNotEquals(void)
89 TestApplication application;
95 DALI_TEST_EQUALS(a != a, false, TEST_LOCATION);
96 DALI_TEST_EQUALS(a != b, false, TEST_LOCATION);
97 DALI_TEST_EQUALS(a != c, true, TEST_LOCATION);