Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

useful debug stuff #41

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "exact_cover"
version = "1.0.0-alpha.0"
version = "1.0.0-alpha.1"
description = "Solve exact cover problems"
readme = "README.md"
authors = ["Moy Easwaran"]
Expand Down
23 changes: 23 additions & 0 deletions tests/test_debug.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import numpy as np
import pytest

from hypothesis import given

from exact_cover import get_exact_cover
from exact_cover.error import NoSolution
from .helpers.polyomino_data import polyomino_problem
from .test_exact_cover_problems import large_problems_without_solution


def test_exact_cover_debug_on():
data = np.array([[1, 0, 0], [0, 1, 0], [0, 1, 1], [0, 0, 1]], dtype=np.int32)
expected = np.array([0, 1, 3])
actual = get_exact_cover(data, debug=True)
np.testing.assert_array_equal(actual, expected)


def test_exact_cover_debug_off():
data = np.array([[1, 0, 0], [0, 1, 0], [0, 1, 1], [0, 0, 1]], dtype=np.int32)
expected = np.array([0, 1, 3])
actual = get_exact_cover(data, debug=False)
np.testing.assert_array_equal(actual, expected)