mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 07:11:41 +00:00
[qfcc] Add failing test case for motor-point sandwich
This tests a subtle bug where part of the product is dropped on the floor due to an issue with aliasing through expand expressions.
This commit is contained in:
parent
84df81bd03
commit
7646f6b51e
2 changed files with 41 additions and 0 deletions
|
@ -50,6 +50,7 @@ test_progs_dat=\
|
||||||
tools/qfcc/test/ptraliasenc.dat \
|
tools/qfcc/test/ptraliasenc.dat \
|
||||||
tools/qfcc/test/ptrfunc.dat \
|
tools/qfcc/test/ptrfunc.dat \
|
||||||
tools/qfcc/test/ptrstructcast.dat \
|
tools/qfcc/test/ptrstructcast.dat \
|
||||||
|
tools/qfcc/test/motor-point.dat \
|
||||||
tools/qfcc/test/quaternion.dat \
|
tools/qfcc/test/quaternion.dat \
|
||||||
tools/qfcc/test/return-ivar.dat \
|
tools/qfcc/test/return-ivar.dat \
|
||||||
tools/qfcc/test/return-postop.dat \
|
tools/qfcc/test/return-postop.dat \
|
||||||
|
@ -610,6 +611,16 @@ tools/qfcc/test/ptrstructcast.run: $(qfcc_test_run_deps)
|
||||||
include $(ptrstructcast_dep) # am--include-marker
|
include $(ptrstructcast_dep) # am--include-marker
|
||||||
r_depfiles_remade += $(ptrstructcast_dep)
|
r_depfiles_remade += $(ptrstructcast_dep)
|
||||||
|
|
||||||
|
tools_qfcc_test_motor_point_dat_SOURCES=tools/qfcc/test/motor-point.r
|
||||||
|
motor_point_obj=$(tools_qfcc_test_motor_point_dat_SOURCES:.r=.o)
|
||||||
|
motor_point_dep=$(call qcautodep,$(tools_qfcc_test_motor_point_dat_SOURCES))
|
||||||
|
tools/qfcc/test/motor-point.dat$(EXEEXT): $(motor_point_obj) $(QFCC_DEP)
|
||||||
|
$(V_QFCCLD)$(QLINK) -o $@ $(motor_point_obj)
|
||||||
|
tools/qfcc/test/motor-point.run: $(qfcc_test_run_deps)
|
||||||
|
@$(top_srcdir)/tools/qfcc/test/build-run $@
|
||||||
|
include $(motor_point_dep) # am--include-marker
|
||||||
|
r_depfiles_remade += $(motor_point_dep)
|
||||||
|
|
||||||
tools_qfcc_test_quaternion_dat_SOURCES=tools/qfcc/test/quaternion.r
|
tools_qfcc_test_quaternion_dat_SOURCES=tools/qfcc/test/quaternion.r
|
||||||
quaternion_obj=$(tools_qfcc_test_quaternion_dat_SOURCES:.r=.o)
|
quaternion_obj=$(tools_qfcc_test_quaternion_dat_SOURCES:.r=.o)
|
||||||
quaternion_dep=$(call qcautodep,$(tools_qfcc_test_quaternion_dat_SOURCES))
|
quaternion_dep=$(call qcautodep,$(tools_qfcc_test_quaternion_dat_SOURCES))
|
||||||
|
|
30
tools/qfcc/test/motor-point.r
Normal file
30
tools/qfcc/test/motor-point.r
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
#include "test-harness.h"
|
||||||
|
|
||||||
|
typedef @algebra(float(3,0,1)) PGA;
|
||||||
|
typedef PGA.group_mask(0xa) bivector_t;
|
||||||
|
typedef PGA.group_mask(0x1e) motor_t;
|
||||||
|
typedef PGA.tvec point_t;
|
||||||
|
|
||||||
|
point_t
|
||||||
|
apply_motor (motor_t m, point_t p)
|
||||||
|
{
|
||||||
|
return (m * p * ~m).tvec;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{
|
||||||
|
motor_t m = {
|
||||||
|
.scalar = 0.707106769,
|
||||||
|
.bvect = (PGA.bvect) '0 0 0.707106769'f,
|
||||||
|
.bvecp = (PGA.bvecp) '0 -4.2426405 0'f,
|
||||||
|
.qvec = (PGA.qvec) 0,
|
||||||
|
};
|
||||||
|
point_t p = (point_t)'10 4 -1.5 1'f;
|
||||||
|
point_t n = apply_motor (m, p);
|
||||||
|
printf ("n: %.9q\n", n);
|
||||||
|
if ((vec4)n != '10 -4 -1.49999988 0.99999994'f) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in a new issue