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

test.h (760B)


      1 #define TEST_H
      2 
      3 #include <inttypes.h>
      4 #include <stdarg.h>
      5 #include <stdbool.h>
      6 #include <stdio.h>
      7 #include <stdlib.h>
      8 #include <string.h>
      9 
     10 #include "../src/arch/arch.h"
     11 
     12 #define STRLENMAX 10000
     13 
     14 /* Basic functions used in most tests */
     15 cube_t solvedcube(void);
     16 bool iserror(cube_t);
     17 bool isconsistent(cube_t);
     18 bool issolvable(cube_t);
     19 bool issolved(cube_t);
     20 cube_t readcube(char *, char *);
     21 void writecube(char *, cube_t, char *);
     22 void nissy_setlogger(void (*logger_function)(const char *, ...));
     23 
     24 /* Test function to be implemented by all tests */
     25 void run(void);
     26 
     27 void log_stderr(const char *str, ...)
     28 {
     29 	va_list args;
     30 
     31 	va_start(args, str);
     32 	vfprintf(stderr, str, args);
     33 	va_end(args);
     34 }
     35 
     36 int main(void) {
     37 	nissy_setlogger(log_stderr);
     38 	run();
     39 	return 0;
     40 }