mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
[gamecode] Add tests for the scale instructions
This commit is contained in:
parent
1a2ac24d8d
commit
f4eeed36b7
2 changed files with 74 additions and 0 deletions
|
@ -12,6 +12,7 @@ libs_gamecode_tests = \
|
|||
libs/gamecode/test/test-int \
|
||||
libs/gamecode/test/test-load \
|
||||
libs/gamecode/test/test-long \
|
||||
libs/gamecode/test/test-scale \
|
||||
libs/gamecode/test/test-stack \
|
||||
libs/gamecode/test/test-store \
|
||||
libs/gamecode/test/test-unsigned \
|
||||
|
@ -92,6 +93,11 @@ libs_gamecode_test_test_long_SOURCES= \
|
|||
libs_gamecode_test_test_long_LDADD= $(test_gamecode_libs)
|
||||
libs_gamecode_test_test_long_DEPENDENCIES= $(test_gamecode_libs)
|
||||
|
||||
libs_gamecode_test_test_scale_SOURCES= \
|
||||
libs/gamecode/test/test-scale.c
|
||||
libs_gamecode_test_test_scale_LDADD= $(test_gamecode_libs)
|
||||
libs_gamecode_test_test_scale_DEPENDENCIES= $(test_gamecode_libs)
|
||||
|
||||
libs_gamecode_test_test_stack_SOURCES= \
|
||||
libs/gamecode/test/test-stack.c
|
||||
libs_gamecode_test_test_stack_LDADD= $(test_gamecode_libs)
|
||||
|
|
68
libs/gamecode/test/test-scale.c
Normal file
68
libs/gamecode/test/test-scale.c
Normal file
|
@ -0,0 +1,68 @@
|
|||
#include "head.c"
|
||||
|
||||
#include "QF/mathlib.h"
|
||||
|
||||
static pr_vec4_t float_scale_init[] = {
|
||||
{ 5, 0, 0, 0},
|
||||
{ 3, 4, 13, 85},
|
||||
{ 0, 0, -1, -2},
|
||||
{ 0, 0, 0, -3},
|
||||
{ 0, 0, 0, 0},
|
||||
};
|
||||
|
||||
static pr_vec4_t float_scale_expect[] = {
|
||||
{ 5, 0, 0, 0},
|
||||
{ 3, 4, 13, 85},
|
||||
{ 15, 20, -1, -2},
|
||||
{ 15, 20, 65, -3},
|
||||
{ 15, 20, 65, 425},
|
||||
};
|
||||
|
||||
static dstatement_t float_scale_statements[] = {
|
||||
{ OP(1, 1, 1, OP_SCALE_F_2), 4, 0, 8 },
|
||||
{ OP(1, 1, 1, OP_SCALE_F_3), 4, 0, 12 },
|
||||
{ OP(1, 1, 1, OP_SCALE_F_4), 4, 0, 16 },
|
||||
};
|
||||
|
||||
static pr_dvec4_t double_scale_init[] = {
|
||||
{ 5, 0, 0, 0},
|
||||
{ 3, 4, 13, 85},
|
||||
{ 0, 0, -1, -2},
|
||||
{ 0, 0, 0, -3},
|
||||
{ 0, 0, 0, 0},
|
||||
};
|
||||
|
||||
static pr_dvec4_t double_scale_expect[] = {
|
||||
{ 5, 0, 0, 0},
|
||||
{ 3, 4, 13, 85},
|
||||
{ 15, 20, -1, -2},
|
||||
{ 15, 20, 65, -3},
|
||||
{ 15, 20, 65, 425},
|
||||
};
|
||||
|
||||
static dstatement_t double_scale_statements[] = {
|
||||
{ OP(1, 1, 1, OP_SCALE_D_2), 8, 0, 16 },
|
||||
{ OP(1, 1, 1, OP_SCALE_D_3), 8, 0, 24 },
|
||||
{ OP(1, 1, 1, OP_SCALE_D_4), 8, 0, 32 },
|
||||
};
|
||||
|
||||
test_t tests[] = {
|
||||
{
|
||||
.desc = "float scale",
|
||||
.num_globals = num_globals(float_scale_init,float_scale_expect),
|
||||
.num_statements = num_statements (float_scale_statements),
|
||||
.statements = float_scale_statements,
|
||||
.init_globals = (pr_int_t *) float_scale_init,
|
||||
.expect_globals = (pr_int_t *) float_scale_expect,
|
||||
},
|
||||
{
|
||||
.desc = "double scale",
|
||||
.num_globals = num_globals(double_scale_init,double_scale_expect),
|
||||
.num_statements = num_statements (double_scale_statements),
|
||||
.statements = double_scale_statements,
|
||||
.init_globals = (pr_int_t *) double_scale_init,
|
||||
.expect_globals = (pr_int_t *) double_scale_expect,
|
||||
},
|
||||
};
|
||||
|
||||
#include "main.c"
|
Loading…
Reference in a new issue