MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/Imath / testFunction

Function testFunction

src/ImathTest/testFunction.cpp:35–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33} // namespace
34
35void
36testFunction ()
37{
38 cout << "halfFunction<T>\n";
39
40 halfFunction<float> d2 (divideByTwo);
41
42 assert (d2 (0) == 0);
43 assert (d2 (2) == 1);
44 assert (d2 (-2) == -1);
45 assert (d2 (HALF_MAX) == HALF_MAX / 2);
46 assert (d2 (-HALF_MAX) == -HALF_MAX / 2);
47 assert (d2 (half::posInf ()) == 0);
48 assert (d2 (half::negInf ()) == 0);
49 assert (d2 (half::qNan ()) == 0);
50
51 halfFunction<half> t5 (
52 timesN (5), // function
53 0,
54 HALF_MAX / 8, // domain
55 -1, // default value
56 half::posInf (), // posInfValue
57 half::negInf (), // negInfValue
58 half::qNan ()); // nanValue
59
60 assert (t5 (0) == 0);
61 assert (t5 (2) == 10);
62 assert (t5 (-2) == -1);
63 assert (t5 (HALF_MAX) == -1);
64 assert (t5 (-HALF_MAX) == -1);
65
66 assert (t5 (half::posInf ()).isInfinity ());
67 assert (!t5 (half::posInf ()).isNegative ());
68
69 assert (t5 (half::negInf ()).isInfinity ());
70 assert (t5 (half::negInf ()).isNegative ());
71
72 assert (t5 (half::qNan ()).isNan ());
73
74 cout << "ok\n\n" << flush;
75}

Callers

nothing calls this directly

Calls 4

timesNClass · 0.85
isInfinityMethod · 0.80
isNegativeMethod · 0.80
isNanMethod · 0.80

Tested by

no test coverage detected