conversion: added from_* methods

This commit is contained in:
2017-07-31 13:16:40 -04:00
parent 80756ebb7a
commit 53bf408e1b
3 changed files with 34 additions and 2 deletions

View File

@@ -100,6 +100,17 @@ TEST silly_conversion() {
x.before = 1;
x.after = (int)(((double)0xffffffff)/10);
ASSERT(-1.1 - silly_to_double(x) <= 0.01);
x = silly_from_float(0.0);
ASSERT_EQ_FMT(0.0, silly_to_double(x), "%f");
x = silly_from_float(-1.1);
ASSERT(-1.1 - silly_to_double(x) <= 0.01);
x = silly_from_double((double) 0.0);
ASSERT_EQ_FMT(0.0, silly_to_double(x), "%f");
x = silly_from_double((double) -1.1);
ASSERT(-1.1 - silly_to_double(x) <= 0.01);
PASS();
}