nissy-core

The "engine" of nissy, including the H48 optimal solver.
git clone https://git.tronto.net/nissy-core
Download | Log | Files | Refs | README | LICENSE

invcoord_co_tests.c (656B)


      1 #include "../test.h"
      2 
      3 #define POW_3_7 2187
      4 
      5 int64_t coord_co(cube_t);
      6 cube_t invcoord_co(int64_t);
      7 
      8 void run(void) {
      9 	oriented_cube_t cube;
     10 	int64_t coord, coord2;
     11 
     12 	cube.orientation = 0;
     13 
     14 	/* Test all possible values for CO coordinate */
     15 	for (coord = 0; coord < POW_3_7; coord++) {
     16 		cube.cube = invcoord_co(coord);
     17 
     18 		if (!isconsistent(cube)) {
     19 			printf("Not consistent\n");
     20 			return;
     21 		}
     22 		if (!issolvable(cube)) {
     23 			printf("Not solvable\n");
     24 			return;
     25 		}
     26 
     27 		coord2 = coord_co(cube.cube);
     28 		if (coord != coord2) {
     29 			printf("Error: invcoord of %" PRId64
     30 			    " returns %" PRId64 "\n", coord, coord2);
     31 			return;
     32 		}
     33 	}
     34 
     35 	printf("All good\n");
     36 }