Skip to content

Commit

Permalink
go api: add nested and interleaved compression tests
Browse files Browse the repository at this point in the history
Without tests or examples from the mod which produces these strings
we are unsure on if these types of compression ever actually can happen.

Given this, we want to add these as test cases to ensure we do not break
the possibly intended behavior.
  • Loading branch information
zdylag authored and MaT1g3R committed Oct 11, 2024
1 parent caf7d31 commit bd056c8
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions backend/api/deck_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,23 @@ func TestDecompress(t *testing.T) {
shouldError: false,
},
{
desc: "Basic compression",
input: "love|slay the||I &0 &0 &1 relics and &1 spire",
desc: "Nested compression succeeds",
input: "love|the|slay &1||I &0 &0 &2 relics and &2 spire",
output: "I love love slay the relics and slay the spire",
shouldError: false,
},
{
desc: "Interleaved compression succeeds",
input: "AAA|BBB&|0CCC||&1&2",
output: "BBBAAACCC",
shouldError: false,
},
{
desc: "Interleaved repeated compression fails",
input: "AAA|BBB&|1CCC||&1&2",
output: "BBB&1CCC",
shouldError: false,
},
{
desc: "Small Deck",
input: "card|junk||0,1,1,0,2,0;;;&01;&1;x;;&02;&1;y;;&03;&1;z",
Expand Down

0 comments on commit bd056c8

Please sign in to comment.