Add tests for get_normalized_scale_factor()
This commit is contained in:
parent
4c8bb37e56
commit
723da9996d
@ -99,7 +99,11 @@ int main(void)
|
||||
(NULL == CU_add_test(pSuite, "test1 finding center ob obj",
|
||||
test_find_center1)) ||
|
||||
(NULL == CU_add_test(pSuite, "test2 finding center ob obj",
|
||||
test_find_center2))
|
||||
test_find_center2)) ||
|
||||
(NULL == CU_add_test(pSuite, "test1 getting normalized scale factor",
|
||||
test_get_normalized_scale_factor1)) ||
|
||||
(NULL == CU_add_test(pSuite, "test2 getting normalized scale factor",
|
||||
test_get_normalized_scale_factor2))
|
||||
) {
|
||||
|
||||
CU_cleanup_registry();
|
||||
|
@ -38,3 +38,6 @@ void test_parse_obj4(void);
|
||||
|
||||
void test_find_center1(void);
|
||||
void test_find_center2(void);
|
||||
|
||||
void test_get_normalized_scale_factor1(void);
|
||||
void test_get_normalized_scale_factor2(void);
|
||||
|
@ -462,3 +462,36 @@ void test_find_center2(void)
|
||||
|
||||
CU_ASSERT_PTR_NULL(newvert);
|
||||
}
|
||||
|
||||
void test_get_normalized_scale_factor1(void)
|
||||
{
|
||||
char const * const string = ""
|
||||
"v 9.0 10.0 11.0\n"
|
||||
"v 11.0 10.0 11.0\n"
|
||||
"v 9.0 11.0 11.0\n"
|
||||
"v 11.0 11.0 11.0\n"
|
||||
"v 9.0 11.0 9.0\n"
|
||||
"v 11.0 11.0 9.0\n"
|
||||
"v 9.0 10.0 9.0\n"
|
||||
"v 11.0 10.0 9.0\n"
|
||||
"f 1 2 4 3\n"
|
||||
"f 3 4 6 5\n"
|
||||
"f 5 6 8 7\n"
|
||||
"f 7 8 2 1\n"
|
||||
"f 2 8 6 4\n"
|
||||
"f 7 1 3 5\n";
|
||||
|
||||
HE_obj *obj = parse_obj(string);
|
||||
HE_vert *newvert = find_center(obj);
|
||||
float factor = get_normalized_scale_factor(obj);
|
||||
|
||||
CU_ASSERT_PTR_NOT_NULL(obj);
|
||||
CU_ASSERT_EQUAL(factor, 0.2f);
|
||||
}
|
||||
|
||||
void test_get_normalized_scale_factor2(void)
|
||||
{
|
||||
float factor = get_normalized_scale_factor(NULL);
|
||||
|
||||
CU_ASSERT_EQUAL(factor, -1);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user