hot topic testing problems

Can some one help .....I am solving a sudoku puzzle
this is the .cpp file

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
int row[9]; // the row that is forbidden 
int col[9]; // the column that is forbidden 
int block[9]; // the block that is forbidden 

int solvepuzz(int board[][9], int  pos)

{ 

	if(pos == 0)
	{
			for(int a = 0; a <9 ;a++) row[a]=col[a]=block[a]=0;
			for(int i = 0; i <9 ;i++)
			for(int j = 0; j <9 ;j++)
	if(board[i][j]!=0)
		{
		   int x = 1<<(board[i][j]-1);
		   int k = i / 3 * 3 + (j / 3);
		   row[i] |= x;
		   col[j] |= x;
		   block[k] |= x;
		}
	}

if(pos == 81) return 1;

 int i = pos / 9; // calculating the row position
 int j = pos % 9; // calculatint the  column position
 int k = i / 3 * 3 + (j / 3); // calculating the  block position
 
if(board[i][j]!=0) return solvepuzz(board, pos+ 1);

		for(int z = 1; z <= 9; z++) 
		{
			  int x = 1 << (z-1);

			  // check the bit similar to bitmask on windows 
			  if(row[i] & x) continue;
			  if(col[j] & x) continue;
			  if(block[k] & x) continue;
			   
			  // mark the bit
			  row[i] |= x; 
			  col[j] |= x; 
			  block[k] |= x;
			   
			  board[i][j] = z;
			  // recursive to the next level
	 if(solvepuzz(board, pos + 1) == 1) return 1;
	 
			board[i][j] = 0;
			// clear the bit
			row[i] &= ~x; 
			col[j] &= ~x; 
			block[k] &= ~x;
	}
 return 0;
}



These are the errors I am getting..

6 8 2 1 7 4 3 9 5 9 -1092356756 1 733707 2134124528 0 4771776 6708908 0 67234292 -1092356756 123618939 67230524 67234292 -1092356728 67231968 67229616 6705784 134533808 6708908 67231552 67229616 -1092356472 6608144 67228056 67228056 8 6708908 -1092356152 -1092356232 -1092356104 134520673 67228128 6180852 -1092355940 -1092355992 1 4715840 -1092355572 -1092354844 -1092354444 -1092354219 267121663 5 733707 15 1027951937 1765815864 1647263052 825438525 1937010735 808467817 892549936 774519346 774519346 1663969850 1630415418 2049845818 808467834 859516976 993013821 993013821 993013821 1818452338 792355433 792357989 1632448354 1768713313 6646883 1937059645 1700950629 1634348914 1768042298 1027822164 963473003 1952541743 1869361010 796029813 1380647027 1919505503 963473003 1027951937 858864974 3289632 1380909171 1313164111 1798271858 1348420684 1667196001 1982817390 3553334 ==19032==
==19032== HEAP SUMMARY:
==19032== in use at exit: 3,784 bytes in 35 blocks
==19032== total heap usage: 46 allocs, 11 frees, 5,006 bytes allocated
==19032==
==19032== LEAK SUMMARY:
==19032== definitely lost: 0 bytes in 0 blocks
==19032== indirectly lost: 0 bytes in 0 blocks
==19032== possibly lost: 100 bytes in 4 blocks
==19032== still reachable: 3,684 bytes in 31 blocks
==19032== suppressed: 0 bytes in 0 blocks
==19032== Rerun with --leak-check=full to see details of leaked memory
==19032==
==19032== For counts of detected and suppressed errors, rerun with: -v
==19032== Use --track-origins=yes to see where uninitialised values come from
==19032== ERROR SUMMARY: 184 errors from 6 contexts (suppressed: 17 from 8)
Segmentation fault
I dont understand.. ii dont even see an int main anywhere
STL so I am multiple files that are just not shown. There are four file main.cpp, sudoku.cpp, sudoku.h, test_sudoku.h and finally test_sudoku.cpp. main is just a magical lines of code like this

main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/ui/text/TestRunner.h>

int main ()
{
    CppUnit::TextUi::TestRunner runner;
    CppUnit::TestFactoryRegistry &registry
        = CppUnit::TestFactoryRegistry::getRegistry();

    runner.addTest (registry.makeTest ());

    return runner.run ("", false);
	

	
}
Topic archived. No new replies allowed.