瀏覽代碼

test: add a unit test for the recent vector promotion problem.

legacy
Sam Hocevar sam 13 年之前
父節點
當前提交
0328a6dfa3
共有 1 個檔案被更改,包括 21 行新增0 行删除
  1. +21
    -0
      test/matrix.cpp

+ 21
- 0
test/matrix.cpp 查看文件

@@ -28,6 +28,7 @@ class MatrixTest : public CppUnit::TestCase
CPPUNIT_TEST(test_vec_eq);
CPPUNIT_TEST(test_vec_lt);
CPPUNIT_TEST(test_vec_unary);
CPPUNIT_TEST(test_vec_cast);
CPPUNIT_TEST(test_mat_det);
CPPUNIT_TEST(test_mat_mul);
CPPUNIT_TEST(test_mat_inv);
@@ -132,6 +133,26 @@ public:
CPPUNIT_ASSERT(-a == b);
}

void test_vec_cast()
{
vec2 a1(1.0f, 3.0f);

vec3 b(a1);
vec2 a2(b);
CPPUNIT_ASSERT(b.x == a1.x);
CPPUNIT_ASSERT(b.y == a1.y);
CPPUNIT_ASSERT(b.z == 0.0f);
CPPUNIT_ASSERT(a2 == a1);

vec4 c(a1);
vec2 a3(c);
CPPUNIT_ASSERT(c.x == a1.x);
CPPUNIT_ASSERT(c.y == a1.y);
CPPUNIT_ASSERT(c.z == 0.0f);
CPPUNIT_ASSERT(c.w == 0.0f);
CPPUNIT_ASSERT(a3 == a1);
}

void test_mat_det()
{
float d1 = triangular.det();


Loading…
取消
儲存