h48

A prototype for an optimal Rubik's cube solver, work in progress.
git clone https://git.tronto.net/h48
Download | Log | Files | Refs | README | LICENSE

basic_tests.c (687B)


      1 #include "../test.h"
      2 
      3 bool issolved(cube_t);
      4 bool equal(cube_t, cube_t);
      5 
      6 void
      7 check(cube_t cube, char *name)
      8 {
      9 	printf("%s is%s solvable\n", name, issolvable(cube) ? "" : " NOT");
     10 	printf("%s is%s solved\n", name, issolved(cube) ? "" : " NOT");
     11 }
     12 
     13 void
     14 check2(cube_t cube1, char *name1, cube_t cube2, char *name2)
     15 {
     16 	printf("%s and %s are%s equal\n", name1, name2,
     17 	    equal(cube1, cube2) ? "" : " NOT");
     18 }
     19 
     20 void run(void) {
     21 	cube_t zero, solved;
     22 
     23 	memset(&zero, 0, sizeof(cube_t));
     24 	solved = solvedcube();
     25 	check(solved, "Solved");
     26 	check(zero, "Zero");
     27 
     28 	check2(solved, "Solved", solved, "Solved");
     29 	check2(solved, "Solved", zero, "Zero");
     30 	check2(zero, "Zero", solved, "Solved");
     31 }