From c0bb2521662ff9bda6030315515da8f6d2ea22b1 Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Mon, 19 Mar 2018 12:11:13 +0200 Subject: [PATCH] Fix a bug w the formatting of the foundations. With the input to freecell solver. Reported by Don - thanks! The format was wrong. --- pysollib/hint.py | 2 +- tests/unit/hint.py | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 tests/unit/hint.py diff --git a/pysollib/hint.py b/pysollib/hint.py index 90de09dc..70496272 100644 --- a/pysollib/hint.py +++ b/pysollib/hint.py @@ -755,7 +755,7 @@ class Base_Solver_Hint: def card2str2(self, card): # foundations - return self._card2str_format('%(S)-s%(R)s', card) + return self._card2str_format('%(S)s-%(R)s', card) # hard solvable: Freecell #47038300998351211829 (65539 iters) diff --git a/tests/unit/hint.py b/tests/unit/hint.py new file mode 100644 index 00000000..a854e90e --- /dev/null +++ b/tests/unit/hint.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python3 +# Written by Shlomi Fish, under the MIT Expat License. + +# imports +import sys +from TAP.Simple import diag, plan, ok + +from pysollib.acard import AbstractCard +from pysollib.hint import Base_Solver_Hint + + +def shlomif_main(args): + + plan(1) + + card = AbstractCard(1001, 0, 3, 7, 3001) + h = Base_Solver_Hint(None, None, base_rank=0) + + got = h.card2str2(card) + # TEST + if not ok(got == 'D-8', 'card2str2 works'): + diag('got == ' + got) + + +if __name__ == "__main__": + sys.exit(shlomif_main(sys.argv))