mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-24 17:10:36 +00:00
devmods/tests:: added -test-push
This commit is contained in:
parent
9050cee2fb
commit
87168241ee
@ -6,6 +6,20 @@ namespace hr {
|
||||
|
||||
namespace tests {
|
||||
|
||||
string test_eq(hyperpoint h1, hyperpoint h2, ld err = 1e-6) {
|
||||
if(sqhypot_d(MDIM, h1 -h2) < err)
|
||||
return "OK";
|
||||
else
|
||||
return "ERROR";
|
||||
}
|
||||
|
||||
string test_eq(transmatrix T1, transmatrix T2, ld err = 1e-6) {
|
||||
if(eqmatrix(T1, T2, err))
|
||||
return "OK";
|
||||
else
|
||||
return "ERROR";
|
||||
}
|
||||
|
||||
int readArgs() {
|
||||
using namespace arg;
|
||||
|
||||
@ -68,6 +82,20 @@ int readArgs() {
|
||||
println(hlog, "(but not in Arnold's cat)");
|
||||
}
|
||||
}
|
||||
else if(argis("-test-push")) {
|
||||
PHASEFROM(3);
|
||||
for(eGeometry g: {gSol, gNil, gCubeTiling, gSpace534, gCell120}) {
|
||||
stop_game();
|
||||
set_geometry(g);
|
||||
println(hlog, "testing geometry: ", geometry_name());
|
||||
hyperpoint h = hyperpoint(.1, .2, .3, 1);
|
||||
h = normalize(h);
|
||||
println(hlog, "h = ", h);
|
||||
println(hlog, "test rgpushxto0: ", test_eq(rgpushxto0(h) * C0, h));
|
||||
println(hlog, "test gpushxto0: ", test_eq(gpushxto0(h) * h, C0));
|
||||
println(hlog, "test inverses: ", test_eq(inverse(rgpushxto0(h)), gpushxto0(h)));
|
||||
}
|
||||
}
|
||||
else return 1;
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user