瀏覽代碼

test: remove isnan() unit tests because we can't rely on that function.

undefined
Sam Hocevar 11 年之前
父節點
當前提交
66b7dd7198
共有 2 個檔案被更改,包括 4 行新增18 行删除
  1. +0
    -8
      test/unit/build.cpp
  2. +4
    -10
      test/unit/half.cpp

+ 0
- 8
test/unit/build.cpp 查看文件

@@ -153,14 +153,6 @@ LOLUNIT_FIXTURE(BuildTest)


LOLUNIT_ASSERT_EQUAL(1.0, y); LOLUNIT_ASSERT_EQUAL(1.0, y);
} }

LOLUNIT_TEST(IsNaN)
{
union { float f; uint32_t x; } u;

u.x = 0x7fc00000u;
LOLUNIT_ASSERT(isnan(u.f));
}
}; };


} /* namespace lol */ } /* namespace lol */


+ 4
- 10
test/unit/half.cpp 查看文件

@@ -159,19 +159,13 @@ LOLUNIT_FIXTURE(HalfTest)
for (uint32_t i = 0; i < 0x10000; i++) for (uint32_t i = 0; i < 0x10000; i++)
{ {
half h = half::makebits(i); half h = half::makebits(i);
if (h.is_nan())
continue;

float f = (float)h; float f = (float)h;
half g = (half)f; half g = (half)f;
LOLUNIT_SET_CONTEXT(i); LOLUNIT_SET_CONTEXT(i);
if (h.is_nan()) LOLUNIT_ASSERT_EQUAL(g.bits, h.bits);
{
LOLUNIT_ASSERT(isnan(f));
LOLUNIT_ASSERT(g.is_nan());
}
else
{
LOLUNIT_ASSERT(!isnan(f));
LOLUNIT_ASSERT_EQUAL(g.bits, h.bits);
}
} }
} }




||||||
x
 
000:0
Loading…
取消
儲存