MCPcopy Create free account
hub / github.com/coin-or/CppAD / base_require

Function base_require

example/valvector/base_require.cpp:30–70  ·  view source on GitHub ↗

base_require

Source from the content-addressed store, hash-verified

28//
29// base_require
30bool base_require(void)
31{ // ok
32 bool ok = true;
33 //
34 // x, y
35 valvector x, y;
36 //
37 // ok
38 x = valvector(2.5);
39 int integer_x = CppAD::Integer(x);
40 ok &= integer_x == 2;
41 //
42 // ok
43 valvector nan = CppAD::numeric_limits<valvector>::quiet_NaN();
44 ok &= CppAD::isnan( nan );
45 //
46 // ok
47 x = valvector( {1, 2} );
48 std::string string_x = CppAD::to_string( x );
49 std::string s;
50 for(auto itr = string_x.begin(); itr != string_x.end(); ++itr)
51 if( *itr != ' ')
52 s.push_back( *itr );
53 ok &= s == "{1,2}";
54 //
55 // ok
56 x = valvector( {1, 2} );
57 y = valvector( {1.0, 2.0} );
58 ok &= CppAD::EqualOpSeq(x, y);
59 //
60 // ok
61 ok &= CppAD::IdenticalCon(x);
62 ok &= ! CppAD::IdenticalZero(x);
63 ok &= ! CppAD::IdenticalOne(x);
64 ok &= CppAD::IdenticalEqualCon(x, y);
65 //
66 x = valvector( {0.0, 0.0} );
67 ok &= CppAD::IdenticalZero(x);
68 //
69 return ok;
70}
71// END C++

Callers

nothing calls this directly

Calls 12

valvectorClass · 0.85
IntegerFunction · 0.50
isnanFunction · 0.50
to_stringFunction · 0.50
EqualOpSeqFunction · 0.50
IdenticalConFunction · 0.50
IdenticalZeroFunction · 0.50
IdenticalOneFunction · 0.50
IdenticalEqualConFunction · 0.50
beginMethod · 0.45
endMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected