cubecore

A library of core functions for working with 3x3x3 Rubik's cubes
git clone https://git.tronto.net/cubecore
Download | Log | Files | Refs | README | LICENSE

basic_tests.c (656B)


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