i965: Test that nonrepresentable floats cannot be converted to VF.
authorMatt Turner <mattst88@gmail.com>
Wed, 4 Nov 2015 22:38:27 +0000 (14:38 -0800)
committerMatt Turner <mattst88@gmail.com>
Sat, 21 Nov 2015 01:39:34 +0000 (17:39 -0800)
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
src/mesa/drivers/dri/i965/test_vf_float_conversions.cpp

index 7f0342548f69f2f03c63be40ab1ea5c736395e3a..7af97d0d09737cf7b69bcd5c38aade4378985deb 100644 (file)
@@ -93,3 +93,18 @@ TEST_F(vf_float_conversion_test, test_special_case_0)
    EXPECT_EQ(f2u(brw_vf_to_float(brw_float_to_vf(+0.0f))), f2u(+0.0f));
    EXPECT_EQ(f2u(brw_vf_to_float(brw_float_to_vf(-0.0f))), f2u(-0.0f));
 }
+
+TEST_F(vf_float_conversion_test, test_nonrepresentable_float_input)
+{
+   EXPECT_EQ(brw_float_to_vf(+32.0f), -1);
+   EXPECT_EQ(brw_float_to_vf(-32.0f), -1);
+
+   EXPECT_EQ(brw_float_to_vf(+16.5f), -1);
+   EXPECT_EQ(brw_float_to_vf(-16.5f), -1);
+
+   EXPECT_EQ(brw_float_to_vf(+8.25f), -1);
+   EXPECT_EQ(brw_float_to_vf(-8.25f), -1);
+
+   EXPECT_EQ(brw_float_to_vf(+4.125f), -1);
+   EXPECT_EQ(brw_float_to_vf(-4.125f), -1);
+}