mirror of
				https://github.com/zenorogue/hyperrogue.git
				synced 2025-10-31 05:52:59 +00:00 
			
		
		
		
	devmods/tests:: added -test-push
This commit is contained in:
		| @@ -6,6 +6,20 @@ namespace hr { | |||||||
|  |  | ||||||
| namespace tests { | 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() { | int readArgs() { | ||||||
|   using namespace arg; |   using namespace arg; | ||||||
|             |             | ||||||
| @@ -68,6 +82,20 @@ int readArgs() { | |||||||
|         println(hlog, "(but not in Arnold's cat)"); |         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; |   else return 1; | ||||||
|   return 0; |   return 0; | ||||||
|   } |   } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Zeno Rogue
					Zeno Rogue