Add a function to get all permutations for a block.
continuous-integration/drone/push Build is passing

This commit is contained in:
2023-11-13 20:53:07 +02:00
parent 6a1ecf93db
commit d1b2ddc351
2 changed files with 15 additions and 1 deletions
@@ -14,12 +14,19 @@
{\a [\a \b] \c [\b \a] \b [\a \c]} "abc" [[\a \b] [\a \c] [\b \a]])))
(deftest get-possible-key-vector-from-reversed-count-map-test
(testing ""
(testing "The block order must be in descending order"
(are [reversed-count-map expected-key-vector]
(= expected-key-vector (get-possible-key-vector-from-reversed-count-map reversed-count-map))
{1 [\a \c] 2 [\b]} [[\b] [\a \c]]
{2 [\a] 1 [\b] 3 [\c]} [[\c] [\a] [\b]])))
(deftest get-all-permutation-for-block-test
(testing "It must return all permutations"
(are [symbols expected-permutations]
(= expected-permutations (get-all-permutation-for-block symbols))
[\a \b] ["ab" "ba"]
[\a \b \c] ["abc" "acb" "bac" "bca" "cab" "cba"])))
(deftest get-possible-keys-test
(testing "The keys must be the all combinations"
(are [possible-keys-vector expected-keys]