1
#include <glib.h>
2
#include <libipuz/libipuz.h>
3
#include <locale.h>
4

            
5

            
6
static void
7
1
test_cell_stats (void)
8
{
9
  IPuzCellStats stats;
10
1
  g_autoptr (IPuzPuzzle) puzzle = NULL;
11
1
  g_autoptr (IPuzPuzzleInfo) info = NULL;
12
1
  GError *error = NULL;
13
1
  g_autofree gchar *path = NULL;
14

            
15
1
  setlocale(LC_ALL, "en_US.utf8");
16

            
17
1
  path = g_test_build_filename (G_TEST_DIST, "quad-pangram.ipuz", NULL);
18
1
  puzzle = ipuz_puzzle_new_from_file (path, &error);
19
1
  g_assert (error == NULL);
20

            
21
1
  info = ipuz_puzzle_get_info (puzzle);
22
1
  g_assert (IPUZ_IS_PUZZLE_INFO (info));
23

            
24
1
  stats = ipuz_puzzle_info_get_cell_stats (info);
25

            
26
1
  g_assert (stats.block_count == 64);
27
1
  g_assert (stats.normal_count == (225-64));
28
1
  g_assert (stats.null_count == 0);
29
1
}
30

            
31
static void
32
1
test_quad_pangram (void)
33
{
34
1
  g_autoptr (IPuzPuzzle) puzzle = NULL;
35
1
  g_autoptr (IPuzPuzzleInfo) info = NULL;
36
1
  GError *error = NULL;
37
1
  g_autofree gchar *path = NULL;
38

            
39
1
  setlocale(LC_ALL, "en_US.utf8");
40

            
41
1
  path = g_test_build_filename (G_TEST_DIST, "quad-pangram.ipuz", NULL);
42
1
  puzzle = ipuz_puzzle_new_from_file (path, &error);
43
1
  g_assert (error == NULL);
44

            
45
1
  info = ipuz_puzzle_get_info (puzzle);
46
1
  g_assert (IPUZ_IS_PUZZLE_INFO (info));
47

            
48
1
  g_assert (ipuz_puzzle_info_get_pangram_count (info) == 4);
49
1
}
50

            
51
int
52
1
main (int   argc,
53
      char *argv[])
54
{
55
1
  g_test_init (&argc, &argv, NULL);
56

            
57
1
  g_test_add_func ("/puzzle-info/quad-pangram", test_quad_pangram);
58
1
  g_test_add_func ("/puzzle-info/cell-stats", test_cell_stats);
59

            
60
1
  return g_test_run ();
61
}
62