#include "../hyper.h" #include #include 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; if(0) ; else if(argis("-test-dist")) { start_game(); shift(); int d = argi(); vector l = currentmap->allcells(); int errors = 0; int unknown = 0; for(cell *c1: l) if(c1->cpdist <= d) for(cell *c2: l) if(c2->cpdist <= d) { int cd = celldistance(c1, c2); int bcd = bounded_celldistance(c1, c2); if(bcd == DISTANCE_UNKNOWN) unknown++; else if(cd != bcd) { errors++; println(hlog, "distance error: ", tie(c1,c2), " cd = ", cd, " bcd = ", bcd); } } int q = 0; for(cell *c: l) if(c->cpdist <= d) q++; println(hlog, "cells checked: ", q, " errors: ", errors, " unknown: ", unknown, " in: ", full_geometry_name()); if(errors) exit(1); } else if(argis("-test-bt")) { PHASEFROM(3); for(int i=0; i Euler characteristic -2 // octagon: -2/6 // ~> 6 octagons } }