File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -252,6 +252,29 @@ main(int argc, char *argv[])
252252 static_cast <float >(
253253 std::numeric_limits<int16_t >::lowest ()) - 1 .0f ,
254254 &failType) && failType == GfNumericCastNegOverflow);
255+
256+ // bool -> int
257+ TF_AXIOM (GfNumericCast<int >(true ).value () == 1 );
258+ TF_AXIOM (GfNumericCast<int >(false ).value () == 0 );
259+
260+ // int -> bool
261+ TF_AXIOM (GfNumericCast<bool >(0 ).value () == false );
262+ TF_AXIOM (GfNumericCast<bool >(1 ).value () == true );
263+
264+ TF_AXIOM (!GfNumericCast<bool >(-1 , &failType) &&
265+ failType == GfNumericCastNegOverflow);
266+
267+ TF_AXIOM (!GfNumericCast<bool >(2 , &failType) &&
268+ failType == GfNumericCastPosOverflow);
269+
270+ TF_AXIOM (GfNumericCast<bool >(static_cast <unsigned >(0 )).value () == false );
271+ TF_AXIOM (GfNumericCast<bool >(static_cast <unsigned >(1 )).value () == true );
272+
273+ TF_AXIOM (!GfNumericCast<bool >(static_cast <unsigned >(2 ), &failType) &&
274+ failType == GfNumericCastPosOverflow);
275+
276+ TF_AXIOM (!GfNumericCast<bool >(std::numeric_limits<unsigned >::max (), &failType) &&
277+ failType == GfNumericCastPosOverflow);
255278
256279 // unsigned
257280 TF_AXIOM (GfNumericCast<uint16_t >(
You can’t perform that action at this time.
0 commit comments