Skip to content

Commit

Permalink
Tests from section 2.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
rocky committed Dec 19, 2024
1 parent de634d1 commit f4e1e2a
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions test/test_combinatorica_v09.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
_initialized: bool = False

combinatorica_file = osp.normpath(
osp.join(osp.dirname(__file__),
"..", "Combinatorica",
"CombinatoricaV0.9.m")
osp.join(osp.dirname(__file__), "..", "Combinatorica", "CombinatoricaV0.9.m")
)


Expand Down Expand Up @@ -505,21 +503,27 @@ def test_2_1_to_2_3():
"{{6}, {5, 1}, {4, 2}, {4, 1, 1}, {3, 3}, "
"{3, 2, 1}, {3, 1, 1, 1}, {2, 2, 2}, {2, 2, 1, 1}, "
"{2, 1, 1, 1, 1}, {1, 1, 1, 1, 1, 1}}",
("Eleven partions of 6; note in reverse lexicographic order. "
"Counting Partitions 2.1.1, Page 52"),
(
"Eleven partions of 6; note in reverse lexicographic order. "
"Counting Partitions 2.1.1, Page 52"
),
),
(
"Partitions[6, 3]",
"{{3, 3}, {3, 2, 1}, {3, 1, 1, 1}, {2, 2, 2}, "
"{2, 2, 1, 1}, {2, 1, 1, 1, 1}, {1, 1, 1, 1, 1, 1}}",
("Most of these partitions do not contain a part bigger than "
"three. Counting Partitions 2.1.1, Page 52"),
(
"Most of these partitions do not contain a part bigger than "
"three. Counting Partitions 2.1.1, Page 52"
),
),
(
"Length[Partitions[20]]",
"627",
("Number of partitions grows exponentially but more slowly than "
"permutations or subsets. Counting Partitions 2.1.1, Page 52"),
(
"Number of partitions grows exponentially but more slowly than "
"permutations or subsets. Counting Partitions 2.1.1, Page 52"
),
),
(
"PartitionsP[10]",
Expand All @@ -542,14 +546,14 @@ def test_2_1_to_2_3():
"Young Tableau 2.3.1, Page 64",
),
(
"TableForm[ {{1,2,5}, {3,4,5}, {6}} ]",
"""ToString["{1, 2, 5}
"TableForm[ {{1,2,5}, {3,4,5}, {6}} ]",
"""ToString["{1, 2, 5}
{3, 4, 5}
{6}
"]""",
"Young Tableau 2.3, Page 64",
"Young Tableau 2.3, Page 64",
),
# (
# "ConstructTableau[{6,4,9,5,7,1,2,8}]",
Expand Down Expand Up @@ -580,6 +584,7 @@ def test_2_1_to_2_3():
):
check_evaluation(str_expr, str_expected, assert_fail_message)


# def test_combinatorica_3_1():
# for str_expr, str_expected, message in (
# (
Expand All @@ -599,6 +604,7 @@ def test_2_1_to_2_3():
# ):
# check_evaluation(str_expr, str_expected, message)


def test_4_1():
for str_expr, str_expected, message in (
(
Expand Down

0 comments on commit f4e1e2a

Please sign in to comment.