示例#1
0
func TestDpll2(t *testing.T) {
	db := db.NewDB(5)
	db.AddEntry([]int{4, -2, -5})
	db.AddEntry([]int{3, 1, -5})
	db.AddEntry([]int{-5, -4, 3})
	db.AddEntry([]int{-3, 4, -2})
	db.AddEntry([]int{1, 4, -3})
	db.AddEntry([]int{-2, 1, 5})
	db.AddEntry([]int{-1, 5, 3})
	db.AddEntry([]int{-4, 2, 5})
	db.AddEntry([]int{-2, -3, -4})
	db.AddEntry([]int{4, -5, 3})
	a := assignment.NewAssignment(5)

	g := Dpll(db, a)
	if g == nil {
		t.Logf("Dpll returned nil\n")
		t.Fail()
	}
	if !db.Verify(g) {
		t.Logf("Dpll returned incorrect solution\n")
		t.Fail()
	}
	fmt.Printf("baz\n")
}
示例#2
0
func TestDpll(t *testing.T) {
	db := db.NewDB(10)
	db.AddEntry([]int{1, 2, 3, -9})
	db.AddEntry([]int{4, 5, 6, -9})
	db.AddEntry([]int{-1, -2, 3, -9})
	db.AddEntry([]int{3, 2, 7, -9})
	a := assignment.NewAssignment(10)

	g := Dpll(db, a)
	if g == nil {
		t.Logf("Dpll returned nil\n")
		t.Fail()
	}
	if !db.Verify(g) {
		t.Logf("Dpll returned incorrect solution\n")
		t.Fail()
	}
	fmt.Printf("bar\n")
}