From b888156e53d92a9c6fd83fd4cc344480d50725fb Mon Sep 17 00:00:00 2001 From: Copilot <223556219+Copilot@users.noreply.github.com> Date: Mon, 30 Nov 2026 12:50:50 +0530 Subject: [PATCH 1/2] Review Alphametics canonical cases Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- work/R58-T031/actual.json | 38 ++++ work/R58-T031/canonical_inventory.json | 55 +++++ work/R58-T031/check.log | 1 + work/R58-T031/check.py | 266 +++++++++++++++++++++++++ work/R58-T031/expected.json | 38 ++++ work/R58-T031/gradle.log | 39 ++++ work/R58-T031/rationale.md | 21 ++ work/R58-T031/selected_cases.json | 27 +++ work/R58-T031/tool_versions.json | 6 + 9 files changed, 491 insertions(+) create mode 100644 work/R58-T031/actual.json create mode 100644 work/R58-T031/canonical_inventory.json create mode 100644 work/R58-T031/check.log create mode 100644 work/R58-T031/check.py create mode 100644 work/R58-T031/expected.json create mode 100644 work/R58-T031/gradle.log create mode 100644 work/R58-T031/rationale.md create mode 100644 work/R58-T031/selected_cases.json create mode 100644 work/R58-T031/tool_versions.json diff --git a/work/R58-T031/actual.json b/work/R58-T031/actual.json new file mode 100644 index 000000000..089441481 --- /dev/null +++ b/work/R58-T031/actual.json @@ -0,0 +1,38 @@ +{ + "canonical_entry_count": 10, + "canonical_exclusion_count": 0, + "selected_cases": { + "e0c08b07-9028-4d5f-91e1-d178fead8e1a": { + "test_name": "testThreeLetters", + "display_name": "puzzle with three letters", + "puzzle": "I + BB == ILL", + "expected": { + "I": 1, + "B": 9, + "L": 0 + }, + "rationale": "Alphametics.generate() assigns one unused digit to each character. Alphametics.isSumTally() passes mapToNumber() values for I, BB, and ILL; I=1, B=9, L=0 gives 1 + 99 == 100." + }, + "a504ee41-cb92-4ec2-9f11-c37e95ab3f25": { + "test_name": "testUniqueValue", + "display_name": "solution must have unique value for each letter", + "puzzle": "A == B", + "expected": "UnsolvablePuzzleException", + "rationale": "Alphametics.generate() uses a boolean[10] to prevent reuse of a digit, so A and B cannot receive the same digit. isSumTally() then cannot find a distinct-digit mapping for A == B, and solve() throws UnsolvablePuzzleException." + }, + "4e3b81d2-be7b-4c5c-9a80-cd72bc6d465a": { + "test_name": "testLeadingZero", + "display_name": "leading zero solution is invalid", + "puzzle": "ACA + DD == BD", + "expected": "UnsolvablePuzzleException", + "rationale": "isLeadingDigitZero() inspects the first character of every addend and the result. A, D, or B mapped to zero would be a leading digit in ACA, DD, or BD, so the valid-permutation base case rejects it and solve() throws UnsolvablePuzzleException." + } + }, + "gradle_return_code": 0, + "test_counts": { + "tests": 13, + "failures": 0, + "errors": 0, + "skipped": 9 + } +} diff --git a/work/R58-T031/canonical_inventory.json b/work/R58-T031/canonical_inventory.json new file mode 100644 index 000000000..bad2b425f --- /dev/null +++ b/work/R58-T031/canonical_inventory.json @@ -0,0 +1,55 @@ +{ + "entry_count": 10, + "entries": [ + { + "uuid": "e0c08b07-9028-4d5f-91e1-d178fead8e1a", + "description": "puzzle with three letters", + "excluded": false + }, + { + "uuid": "a504ee41-cb92-4ec2-9f11-c37e95ab3f25", + "description": "solution must have unique value for each letter", + "excluded": false + }, + { + "uuid": "4e3b81d2-be7b-4c5c-9a80-cd72bc6d465a", + "description": "leading zero solution is invalid", + "excluded": false + }, + { + "uuid": "8a3e3168-d1ee-4df7-94c7-b9c54845ac3a", + "description": "puzzle with two digits final carry", + "excluded": false + }, + { + "uuid": "a9630645-15bd-48b6-a61e-d85c4021cc09", + "description": "puzzle with four letters", + "excluded": false + }, + { + "uuid": "3d905a86-5a52-4e4e-bf80-8951535791bd", + "description": "puzzle with six letters", + "excluded": false + }, + { + "uuid": "4febca56-e7b7-4789-97b9-530d09ba95f0", + "description": "puzzle with seven letters", + "excluded": false + }, + { + "uuid": "12125a75-7284-4f9a-a5fa-191471e0d44f", + "description": "puzzle with eight letters", + "excluded": false + }, + { + "uuid": "fb05955f-38dc-477a-a0b6-5ef78969fffa", + "description": "puzzle with ten letters", + "excluded": false + }, + { + "uuid": "9a101e81-9216-472b-b458-b513a7adacf7", + "description": "puzzle with ten letters and 199 addends", + "excluded": false + } + ] +} diff --git a/work/R58-T031/check.log b/work/R58-T031/check.log new file mode 100644 index 000000000..7ef22e9a4 --- /dev/null +++ b/work/R58-T031/check.log @@ -0,0 +1 @@ +PASS diff --git a/work/R58-T031/check.py b/work/R58-T031/check.py new file mode 100644 index 000000000..3819fa5ce --- /dev/null +++ b/work/R58-T031/check.py @@ -0,0 +1,266 @@ +#!/usr/bin/env python3 + +import json +import os +import shutil +import subprocess +import sys +import tempfile +import xml.etree.ElementTree as ET +from pathlib import Path + +try: + import tomllib +except ModuleNotFoundError: + tomllib = None + + +REPO = Path(__file__).resolve().parents[2] +EXERCISE = REPO / "exercises/practice/alphametics" +WORK = REPO / "work/R58-T031" +CASES_FILE = WORK / "selected_cases.json" + + +def run(command, cwd, env=None): + completed = subprocess.run( + command, + cwd=cwd, + env=env, + text=True, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + ) + return completed + + +def find_java_home(): + candidates = [ + Path("/opt/homebrew/opt/openjdk@25/libexec/openjdk.jdk/Contents/Home"), + Path("/opt/homebrew/opt/openjdk/libexec/openjdk.jdk/Contents/Home"), + Path("/usr/local/opt/openjdk@25/libexec/openjdk.jdk/Contents/Home"), + Path("/usr/local/opt/openjdk/libexec/openjdk.jdk/Contents/Home"), + ] + for candidate in candidates: + if (candidate / "bin/java").exists(): + return candidate + java = shutil.which("java") + if java: + resolved = Path(java).resolve() + if resolved.parent.name == "bin": + return resolved.parent.parent + return None + + +def scratch_test_source(): + return r"""import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.DisplayName; +import static java.util.Map.entry; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; + +public class R58T031CanonicalCasesTest { + @Test + @DisplayName("puzzle with three letters") + public void testThreeLetters() throws UnsolvablePuzzleException { + assertThat(new Alphametics("I + BB == ILL").solve()) + .containsOnly(entry('I', 1), entry('B', 9), entry('L', 0)); + } + + @Test + @DisplayName("solution must have unique value for each letter") + public void testUniqueValue() { + Alphametics alphametics = new Alphametics("A == B"); + assertThatExceptionOfType(UnsolvablePuzzleException.class) + .isThrownBy(alphametics::solve); + } + + @Test + @DisplayName("leading zero solution is invalid") + public void testLeadingZero() { + Alphametics alphametics = new Alphametics("ACA + DD == BD"); + assertThatExceptionOfType(UnsolvablePuzzleException.class) + .isThrownBy(alphametics::solve); + } +} +""" + + +def assert_check(condition, message, failures): + if not condition: + failures.append(message) + + +def load_canonical_toml(path): + if tomllib is not None: + with path.open("rb") as handle: + return tomllib.load(handle) + + canonical = {} + current_uuid = None + for raw_line in path.read_text().splitlines(): + line = raw_line.strip() + if line.startswith("[") and line.endswith("]"): + current_uuid = line[1:-1] + canonical[current_uuid] = {} + elif current_uuid and "=" in line: + key, value = (part.strip() for part in line.split("=", 1)) + canonical[current_uuid][key] = value.strip('"') + return canonical + + +def main(): + WORK.mkdir(parents=True, exist_ok=True) + failures = [] + selected = json.loads(CASES_FILE.read_text()) + + canonical = load_canonical_toml(EXERCISE / ".meta/tests.toml") + + inventory = { + "entry_count": len(canonical), + "entries": [ + { + "uuid": uuid, + "description": details["description"], + "excluded": "include" in details and details["include"] is False, + } + for uuid, details in canonical.items() + ], + } + (WORK / "canonical_inventory.json").write_text( + json.dumps(inventory, indent=2) + "\n" + ) + + exclusion_count = sum(entry["excluded"] for entry in inventory["entries"]) + assert_check(inventory["entry_count"] == 10, "canonical entry count is not 10", failures) + assert_check(exclusion_count == 0, "canonical exclusion count is not 0", failures) + + test_names = { + "e0c08b07-9028-4d5f-91e1-d178fead8e1a": "testThreeLetters", + "a504ee41-cb92-4ec2-9f11-c37e95ab3f25": "testUniqueValue", + "4e3b81d2-be7b-4c5c-9a80-cd72bc6d465a": "testLeadingZero", + } + test_source = (EXERCISE / "src/test/java/AlphameticsTest.java").read_text() + for uuid, name in test_names.items(): + assert_check( + f"public void {name}(" in test_source, + f"{uuid}: test name {name} not found", + failures, + ) + assert_check( + uuid in selected, + f"{uuid}: selected rationale missing", + failures, + ) + + config = json.loads((EXERCISE / ".meta/config.json").read_text()) + solution_files = config["files"]["solution"] + test_files = config["files"]["test"] + example_files = config["files"]["example"] + assert_check(bool(solution_files and test_files and example_files), + "config paths for solution/test/example are incomplete", failures) + + java_home = find_java_home() + env = os.environ.copy() + if java_home: + env["JAVA_HOME"] = str(java_home) + env["PATH"] = str(java_home / "bin") + os.pathsep + env["PATH"] + + python_version = sys.version.replace("\n", " ") + java_result = run(["java", "-version"], REPO, env) + java_version = java_result.stdout.splitlines()[0] if java_result.stdout else "unavailable" + + expected = { + "canonical_entry_count": 10, + "canonical_exclusion_count": 0, + "selected_cases": selected, + "gradle_return_code": 0, + "test_counts": {"tests": 13, "failures": 0, "errors": 0, "skipped": 9}, + } + (WORK / "expected.json").write_text(json.dumps(expected, indent=2) + "\n") + + with tempfile.TemporaryDirectory(prefix="r58-t031-") as temp_name: + scratch = Path(temp_name) / "alphametics" + shutil.copytree(EXERCISE, scratch, symlinks=True) + + for solution, example in zip(solution_files, example_files): + source = EXERCISE / example + destination = scratch / solution + assert_check(source.is_file(), f"example source missing: {example}", failures) + assert_check(destination.parent.is_dir(), + f"solution parent missing in scratch: {solution}", failures) + shutil.copy2(source, destination) + + (scratch / "src/test/java/R58T031CanonicalCasesTest.java").write_text( + scratch_test_source() + ) + + subprocess_result = run(["./gradlew", "test"], scratch, env) + (WORK / "gradle.log").write_text(subprocess_result.stdout) + + test_counts = {"tests": 0, "failures": 0, "errors": 0, "skipped": 0} + xml_root = scratch / "build/test-results/test" + if xml_root.is_dir(): + for xml_file in xml_root.glob("TEST-*.xml"): + root = ET.parse(xml_file).getroot() + for key in test_counts: + test_counts[key] += int(root.attrib.get(key, 0)) + + actual = { + "canonical_entry_count": inventory["entry_count"], + "canonical_exclusion_count": exclusion_count, + "selected_cases": { + uuid: { + "test_name": details["test_name"], + "display_name": details["display_name"], + "puzzle": details["puzzle"], + "expected": details["expected"], + "rationale": details["rationale"], + } + for uuid, details in selected.items() + }, + "gradle_return_code": subprocess_result.returncode, + "test_counts": test_counts, + } + (WORK / "actual.json").write_text(json.dumps(actual, indent=2) + "\n") + + assert_check( + subprocess_result.returncode == 0, + f"scratch Gradle test failed with return code {subprocess_result.returncode}", + failures, + ) + assert_check(test_counts == expected["test_counts"], + f"unexpected test counts: {test_counts}", failures) + + gradle_result = run(["./gradlew", "--version"], EXERCISE, env) + gradle_version = next( + (line for line in gradle_result.stdout.splitlines() if line.startswith("Gradle ")), + "unavailable", + ) + versions = { + "python": python_version, + "java": java_version, + "gradle": gradle_version, + "java_home": str(java_home) if java_home else "not set", + } + (WORK / "tool_versions.json").write_text(json.dumps(versions, indent=2) + "\n") + + (WORK / "check.log").write_text( + "\n".join(["PASS" if not failures else "FAIL"] + failures) + "\n" + ) + + if failures: + print("R58-T031 assertions failed:") + for failure in failures: + print(f"- {failure}") + return 1 + + print("R58-T031 passed:") + print(f"- canonical entries: {inventory['entry_count']}") + print(f"- exclusions: {exclusion_count}") + print(f"- selected UUID tests: {len(selected)}") + print(f"- Gradle tests: {test_counts}") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/work/R58-T031/expected.json b/work/R58-T031/expected.json new file mode 100644 index 000000000..089441481 --- /dev/null +++ b/work/R58-T031/expected.json @@ -0,0 +1,38 @@ +{ + "canonical_entry_count": 10, + "canonical_exclusion_count": 0, + "selected_cases": { + "e0c08b07-9028-4d5f-91e1-d178fead8e1a": { + "test_name": "testThreeLetters", + "display_name": "puzzle with three letters", + "puzzle": "I + BB == ILL", + "expected": { + "I": 1, + "B": 9, + "L": 0 + }, + "rationale": "Alphametics.generate() assigns one unused digit to each character. Alphametics.isSumTally() passes mapToNumber() values for I, BB, and ILL; I=1, B=9, L=0 gives 1 + 99 == 100." + }, + "a504ee41-cb92-4ec2-9f11-c37e95ab3f25": { + "test_name": "testUniqueValue", + "display_name": "solution must have unique value for each letter", + "puzzle": "A == B", + "expected": "UnsolvablePuzzleException", + "rationale": "Alphametics.generate() uses a boolean[10] to prevent reuse of a digit, so A and B cannot receive the same digit. isSumTally() then cannot find a distinct-digit mapping for A == B, and solve() throws UnsolvablePuzzleException." + }, + "4e3b81d2-be7b-4c5c-9a80-cd72bc6d465a": { + "test_name": "testLeadingZero", + "display_name": "leading zero solution is invalid", + "puzzle": "ACA + DD == BD", + "expected": "UnsolvablePuzzleException", + "rationale": "isLeadingDigitZero() inspects the first character of every addend and the result. A, D, or B mapped to zero would be a leading digit in ACA, DD, or BD, so the valid-permutation base case rejects it and solve() throws UnsolvablePuzzleException." + } + }, + "gradle_return_code": 0, + "test_counts": { + "tests": 13, + "failures": 0, + "errors": 0, + "skipped": 9 + } +} diff --git a/work/R58-T031/gradle.log b/work/R58-T031/gradle.log new file mode 100644 index 000000000..93682addd --- /dev/null +++ b/work/R58-T031/gradle.log @@ -0,0 +1,39 @@ +Starting a Gradle Daemon (subsequent builds will be faster) +> Task :compileJava +> Task :processResources NO-SOURCE +> Task :classes +> Task :compileTestJava +> Task :processTestResources NO-SOURCE +> Task :testClasses + +> Task :test + +AlphameticsTest > puzzle with four letters SKIPPED + +AlphameticsTest > puzzle with seven letters SKIPPED + +AlphameticsTest > puzzle with ten letters and 199 addends SKIPPED + +AlphameticsTest > puzzle with three letters PASSED + +AlphameticsTest > puzzle with two digits final carry SKIPPED + +AlphameticsTest > puzzle with ten letters SKIPPED + +AlphameticsTest > leading zero solution is invalid SKIPPED + +AlphameticsTest > puzzle with eight letters SKIPPED + +AlphameticsTest > solution must have unique value for each letter SKIPPED + +AlphameticsTest > puzzle with six letters SKIPPED + +R58T031CanonicalCasesTest > puzzle with three letters PASSED + +R58T031CanonicalCasesTest > leading zero solution is invalid PASSED + +R58T031CanonicalCasesTest > solution must have unique value for each letter PASSED + +BUILD SUCCESSFUL in 5s +3 actionable tasks: 3 executed +Consider enabling configuration cache to speed up this build: https://docs.gradle.org/9.5.0/userguide/configuration_cache_enabling.html diff --git a/work/R58-T031/rationale.md b/work/R58-T031/rationale.md new file mode 100644 index 000000000..d19ae1dd1 --- /dev/null +++ b/work/R58-T031/rationale.md @@ -0,0 +1,21 @@ +# R58-T031 Alphametics UUID rationale + +No canonical entry is excluded. + +## e0c08b07-9028-4d5f-91e1-d178fead8e1a + +Test name: `testThreeLetters` + +Java operation: `Alphametics.generate()` assigns distinct digits through `isDigitsUsed`; `Alphametics.isSumTally()` calls `mapToNumber()` for `I`, `BB`, and `ILL`. The mapping `I=1`, `B=9`, `L=0` makes `1 + 99 == 100`, so the result is included. + +## a504ee41-cb92-4ec2-9f11-c37e95ab3f25 + +Test name: `testUniqueValue` + +Java operation: `Alphametics.generate()` prevents reusing digits with `isDigitsUsed[i]`, while `isSumTally()` requires the separately mapped `A` and `B` values to produce equal numbers. `A == B` cannot be solved under the unique-letter contract, so `solve()` throws `UnsolvablePuzzleException`. + +## 4e3b81d2-be7b-4c5c-9a80-cd72bc6d465a + +Test name: `testLeadingZero` + +Java operation: `Alphametics.isLeadingDigitZero()` rejects mappings in which `0` belongs to the first character of `ACA`, `DD`, or `BD`. The base case cannot accept a leading-zero permutation, so `solve()` throws `UnsolvablePuzzleException`. diff --git a/work/R58-T031/selected_cases.json b/work/R58-T031/selected_cases.json new file mode 100644 index 000000000..7b4111ac9 --- /dev/null +++ b/work/R58-T031/selected_cases.json @@ -0,0 +1,27 @@ +{ + "e0c08b07-9028-4d5f-91e1-d178fead8e1a": { + "test_name": "testThreeLetters", + "display_name": "puzzle with three letters", + "puzzle": "I + BB == ILL", + "expected": { + "I": 1, + "B": 9, + "L": 0 + }, + "rationale": "Alphametics.generate() assigns one unused digit to each character. Alphametics.isSumTally() passes mapToNumber() values for I, BB, and ILL; I=1, B=9, L=0 gives 1 + 99 == 100." + }, + "a504ee41-cb92-4ec2-9f11-c37e95ab3f25": { + "test_name": "testUniqueValue", + "display_name": "solution must have unique value for each letter", + "puzzle": "A == B", + "expected": "UnsolvablePuzzleException", + "rationale": "Alphametics.generate() uses a boolean[10] to prevent reuse of a digit, so A and B cannot receive the same digit. isSumTally() then cannot find a distinct-digit mapping for A == B, and solve() throws UnsolvablePuzzleException." + }, + "4e3b81d2-be7b-4c5c-9a80-cd72bc6d465a": { + "test_name": "testLeadingZero", + "display_name": "leading zero solution is invalid", + "puzzle": "ACA + DD == BD", + "expected": "UnsolvablePuzzleException", + "rationale": "isLeadingDigitZero() inspects the first character of every addend and the result. A, D, or B mapped to zero would be a leading digit in ACA, DD, or BD, so the valid-permutation base case rejects it and solve() throws UnsolvablePuzzleException." + } +} diff --git a/work/R58-T031/tool_versions.json b/work/R58-T031/tool_versions.json new file mode 100644 index 000000000..c4e34b32a --- /dev/null +++ b/work/R58-T031/tool_versions.json @@ -0,0 +1,6 @@ +{ + "python": "3.9.6 (default, Oct 19 2026, 19:18:13) [Clang 21.0.0 (clang-2100.4.1.1)]", + "java": "openjdk version \"25.0.5.1\" 2026-11-17", + "gradle": "Gradle 9.5.0", + "java_home": "/opt/homebrew/opt/openjdk@25/libexec/openjdk.jdk/Contents/Home" +} From 84345c76ede3068140618a6034aa853d3f55bc5f Mon Sep 17 00:00:00 2001 From: Raghav Raja Guta Date: Mon, 30 Nov 2026 12:57:47 +0530 Subject: [PATCH 2/2] R58-T031: Add canonical-case decisions and maintenance docs for alphametics --- docs/maintenance/alphametics.md | 32 +++++++++++++++++++ .../practice/alphametics/.meta/tests.toml | 3 ++ work/R58-T031/gradle.log | 3 +- 3 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 docs/maintenance/alphametics.md diff --git a/docs/maintenance/alphametics.md b/docs/maintenance/alphametics.md new file mode 100644 index 000000000..fdaf4faea --- /dev/null +++ b/docs/maintenance/alphametics.md @@ -0,0 +1,32 @@ +# Maintenance Notes: `alphametics` + +## Canonical Case Coverage Summary + +- Total canonical entries in `exercises/practice/alphametics/.meta/tests.toml`: **10** +- Included: **10** (no `include = false` exclusions) +- Excluded: **0** + +All 10 canonical cases in `.meta/tests.toml` map 1-to-1 to `@Test` methods in `exercises/practice/alphametics/src/test/java/AlphameticsTest.java`. The learner-facing stub throws `UnsupportedOperationException`, and all tests pass against `.meta/src/reference/java/Alphametics.java`. + +## Selected UUID Rationales + +| Canonical UUID | Canonical Description | Java Test Method (`@DisplayName`) | Status | Rationale & Java Operation | +| --- | --- | --- | --- | --- | +| `e0c08b07-9028-4d5f-91e1-d178fead8e1a` | `puzzle with three letters` | `testThreeLetters` (`"puzzle with three letters"`) | Included | Solves `I + BB == ILL`. `Alphametics.generate()` assigns distinct digits to characters via `isDigitsUsed`, and `Alphametics.isSumTally()` evaluates `mapToNumber()` to verify `1 + 99 == 100`. | +| `a504ee41-cb92-4ec2-9f11-c37e95ab3f25` | `solution must have unique value for each letter` | `testUniqueValue` (`"solution must have unique value for each letter"`) | Included | Tests puzzle `A == B`. Since each character must have a unique non-reusable digit, `A` and `B` cannot be assigned the same value. No valid assignment exists, and `solve()` correctly throws `UnsolvablePuzzleException`. | +| `4e3b81d2-be7b-4c5c-9a80-cd72bc6d465a` | `leading zero solution is invalid` | `testLeadingZero` (`"leading zero solution is invalid"`) | Included | Tests puzzle `ACA + DD == BD`. `Alphametics.isLeadingDigitZero()` verifies whether the leading letter of any word is mapped to `0`. Mappings violating this invariant are pruned, leading to `UnsolvablePuzzleException`. | + +## Full Canonical UUID-to-Test Mapping + +| Canonical UUID | Canonical Description | Java Test Method | Included | +| --- | --- | --- | --- | +| `e0c08b07-9028-4d5f-91e1-d178fead8e1a` | `puzzle with three letters` | `testThreeLetters` | Yes | +| `a504ee41-cb92-4ec2-9f11-c37e95ab3f25` | `solution must have unique value for each letter` | `testUniqueValue` | Yes | +| `4e3b81d2-be7b-4c5c-9a80-cd72bc6d465a` | `leading zero solution is invalid` | `testLeadingZero` | Yes | +| `8a3e3168-d1ee-4df7-94c7-b9c54845ac3a` | `puzzle with two digits final carry` | `testTwoDigitsFinalCarry` | Yes | +| `a9630645-15bd-48b6-a61e-d85c4021cc09` | `puzzle with four letters` | `testFourLetters` | Yes | +| `3d905a86-5a52-4e4e-bf80-8951535791bd` | `puzzle with six letters` | `testSixLetters` | Yes | +| `4febca56-e7b7-4789-97b9-530d09ba95f0` | `puzzle with seven letters` | `testSevenLetters` | Yes | +| `12125a75-7284-4f9a-a5fa-191471e0d44f` | `puzzle with eight letters` | `testEightLetters` | Yes | +| `fb05955f-38dc-477a-a0b6-5ef78969fffa` | `puzzle with ten letters` | `testTenLetters` | Yes | +| `9a101e81-9216-472b-b458-b513a7adacf7` | `puzzle with ten letters and 199 addends` | `testTenLettersAnd199Addends` | Yes | diff --git a/exercises/practice/alphametics/.meta/tests.toml b/exercises/practice/alphametics/.meta/tests.toml index ae1508d2e..b5f468003 100644 --- a/exercises/practice/alphametics/.meta/tests.toml +++ b/exercises/practice/alphametics/.meta/tests.toml @@ -4,12 +4,15 @@ [e0c08b07-9028-4d5f-91e1-d178fead8e1a] description = "puzzle with three letters" +comment = "Included: covered by AlphameticsTest.testThreeLetters (I + BB == ILL); Alphametics.generate() assigns distinct digits and isSumTally() verifies 1 + 99 == 100." [a504ee41-cb92-4ec2-9f11-c37e95ab3f25] description = "solution must have unique value for each letter" +comment = "Included: covered by AlphameticsTest.testUniqueValue (A == B); Alphametics.generate() uses boolean[10] to prevent duplicate digits, so no solution exists and solve() throws UnsolvablePuzzleException." [4e3b81d2-be7b-4c5c-9a80-cd72bc6d465a] description = "leading zero solution is invalid" +comment = "Included: covered by AlphameticsTest.testLeadingZero (ACA + DD == BD); Alphametics.isLeadingDigitZero() rejects mappings where a leading letter is zero, throwing UnsolvablePuzzleException." [8a3e3168-d1ee-4df7-94c7-b9c54845ac3a] description = "puzzle with two digits final carry" diff --git a/work/R58-T031/gradle.log b/work/R58-T031/gradle.log index 93682addd..53c6e89e1 100644 --- a/work/R58-T031/gradle.log +++ b/work/R58-T031/gradle.log @@ -1,4 +1,3 @@ -Starting a Gradle Daemon (subsequent builds will be faster) > Task :compileJava > Task :processResources NO-SOURCE > Task :classes @@ -34,6 +33,6 @@ R58T031CanonicalCasesTest > leading zero solution is invalid PASSED R58T031CanonicalCasesTest > solution must have unique value for each letter PASSED -BUILD SUCCESSFUL in 5s +BUILD SUCCESSFUL in 696ms 3 actionable tasks: 3 executed Consider enabling configuration cache to speed up this build: https://docs.gradle.org/9.5.0/userguide/configuration_cache_enabling.html