Skip to content

Tree Tent Test Suite Docs

Jaden Tian edited this page Apr 9, 2024 · 1 revision

Symbol Key

X - Unknown Cell
G - Grass
T - Tent R - Tree 2,3,... - Clue Value
x (referring to clue value) - Unused clue value

Individual cells within grids are referenced with (x,y), where x is the column number and y is the row number.
Row indexing begins with 0 at the top, and increases towards the bottom.
Column indexing begins with 0 at the left and increases towards the right.
Clue values are omitted for tests that don't rely on them.
For rules that rely on creating or placing lines, they are listed as two points

Direct Rule Tests

Empty Field Direct Rule - TREE-BASC-0001

Test Case 1 - Empty Field:
XXX
XGX
XXX

  • Checks if the rule correctly detects no trees around the grass tile

Test Case 2 - Diagonal Trees:
RXR
XGX
RXR

  • Checks if the rule correctly ignores the trees on the diagonals

Test Case 3 - Four Adjacent Trees:
XRX
RGR
XRX

  • Checks if the rule is not valid when there are adjacent trees

Test Case 4 - One Adjacent Tree:
XRX
XGX
XXX

  • Checks if the rule is not valid when there is one adjacent tree

Finish With Grass - TREE-BASC-0002

Test Case 1 - Horizontal Test with One Tent:
XXX x
GTG 1
XXX x
xxx

  • Checks if the rule detects the middle row to be filled in correctly

Test Case 2 - Vertical Test with One Tent:
TXX x
GXX x
GXX x
1 x x

  • Checks if the rule detects the leftmost column to be filled in correctly

Test Case 3 - Both Directions One Tent:
TGG 1
GXX x
GXX x
1xx

  • Checks if the rule detects the top row and leftmost column to be filled in correctly

Test Case 4 - No Tent:
GGG 0
GGG 0
GGG 0
000

  • Checks if the rule allows all cells to be filled when the clue for all rows and columns is zero.

Test Case 5 - Middle Tent:
XGX x
GTG 1
XGX x
x1x

  • Checks if the rule correctly allows the central row and column to be filled with grass.

Test Case 6 - Missing Tent:
GGG 1
GGG 1
GGG 1
111

  • Checks if the rule is not valid when a row or column does not have the required number of tents but is filled with grass

Test Case 7 - Spaced Out Tents:
XXXXXXX x
XXXXXXX x
XXXXXXX x
TGTGTGT 4
XXXXXXX x
XXXXXXX x
XXXXXXX x
xxxxxxx

  • Checks if applying the rule on row 3 is valid

Finish with Tents Direct Rule - TREE-BASC-0003

Test Case 1 - Horizontal Test
GTT 2
XXX x
XXX x
xxx

  • Checks that the rule correctly fills in the first row

Test Case 2 - Vertical Test
GXX x
TXX x
TXX x
2xx

  • Checks that the rule correctly fills in the first column

Test Case 3 - Horizontal and Vertical Simultaneous
GTT 2
TXX x
TXX x
2xx

  • Checks that the rule correctly fills both the first row and first column

Test Case 4 - Surrounding Tents Test
XTX x
TTT 3
XTX x
x3x

  • Checks that the rule correctly fills in the middle row and column when a tent starts at (1, 1)

Test Case 5 - Way Too Many Tents
TTT 0
TTT 0
TTT 0
000

  • Checks that the rule does not allow for more tents in any of the rows or columns

Test Case 6 - Too Many Tents
XTX x
TTT 1
XTX x
x1x

  • Checks that the rule does not allow for more tents in the central row or central column

Test Case 7 - Ambiguous Tents
XTX x
TTT 2
XTX x
x2x

  • Checks that the rule is not satisfied because there are multiple configurations of tents for the central row and central column

Last Camping Spot Direct Rule - TREE-BASC-0004

Test Case 1 - Test Above
XTX
RRG
XGX

  • Checks that a tent must be placed above the central tree

Test Case 2 - Test Down
XGX
RRG
XTX

  • Checks that a tent must be placed below the central tree

Test Case 3 - Test Left
XGX
TRR
XGX

  • Checks that a tent must be placed on the left of the central tree

Test Case 4 - Test Right
XGX
GRT
XRX

  • Checks that a tent must be placed to the right of the central tree

Surround Tent With Grass Direct Rule - TREE-BASC-0005

Test Case 1 - Fill in Missing Test
RGR
RTR
GRR

  • Checks that the rule detects unknown adjacent and diagonal tiles correctly

Test Case 2 - Full Surround
GGG
GTG
GGG

  • Checks that the rule detects all adjacent and diagonal tiles correctly

Test Case 3 - No Missing Tiles
RRR
RTR
RRR

  • Checks that the rule correctly detects no missing tiles

Tent For Tree Direct Rule - TREE-BASC-0006

Test Case 1 - Single Tent
XRX
XTX
XXX

  • Checks that the rule correctly detects the central tent as the only possible connection

Test Case 2 - Arbitrary Tree
XRX
XTX
XRX

  • Checks that the rule works when connecting a line between the tree at (1, 0) and (1, 1)

Test Case 3 - Preexisting Line
Line Connects (1, 0) and (1, 1)
XRX
XTX
XRX

  • Checks that the rule fails for the tree at (1, 2) because there are no valid tents to connect to

Test Case 4 - Two Adjacent Tents
XTX
XRX
XTX

  • Checks that the rule fails for the tree at (1, 1) because there are two valid tents to connect to

Tree For Tent Direct Rule - TREE-BASC-0007

Test Case 1 - Single Tree
XTX
XRX
XXX

  • Checks that the rule correctly detects the central tree as the only possible connection

Test Case 2 - Arbitrary Tent
XTX
XRX
XTX

  • Checks that the rule works when connecting a line between the tent at (1, 0) and tree at (1, 1)

Test Case 3 - Preexisting Line
Line Connects (1, 0) and (1, 1)
XRX
XTX
XRX

  • Checks that the rule fails for the tent at (1, 2) because there are no valid tree to connect to

Test Case 4 - Two Adjacent Trees
XRX
XTX
XRX

  • Checks that the rule fails for the tent at (1, 1) because there are two valid trees to connect to

Contradiction Rule Tests

No Tent For Tree Contradiction Rule - TREE-CONT-0001

//TODO Add test for tents that are already connected to another tree

Test Case 1 - Simple Lone Tree
RG
GG

  • Checks that the tree at (0, 0) does not have an adjacent tent

Test Case 2 - Diagonal Tent to Lone Tree
RG
GT

  • Checks that the rule does not detect a diagonal tent as a valid tent

Test Case 3 - Adjacent Trees
RR
GG

  • Checks that the rule does not detect an adjacent tree as a valid connection

Test Case 4 - One Invalid, One Valid
RR
GT

  • Checks that the rule correctly detects the tree at (0, 0) as a contradiction, but not at (1, 0)

No Tree For Tent Contradiction Rule - TREE-CONT-0002

//TODO Add test for trees that are already connected to another tent

Test Case 1 - (0, 0) Tent
TG
GG

  • Checks that the rule is valid for the tent at (0, 0)

Test Case 2 - (1, 0) Tent
GT
GG

  • Checks that the rule is valid for the tent at (1, 0)

Test Case 3 - (0, 1) Tent
GG
TG

  • Checks that the rule is valid for the tent at (0, 1)

Test Case 4 - (1, 1) Tent
GG
GT

  • Checks that the rule is valid for the tent at (1, 1)

Test Case 5 - Central Tent
GGG
GTG
GGG

  • Checks that the rule is valid for the tent at (1, 1)

Test Case 6 - Diagonal Trees
RGR
GTG
RGR

  • Checks that the rule does not erroneously detect a contradiction

Test Case 7 - Valid Tent Tree Pair
GGG
RTG
GGG

  • Checks that the rule does not erroneously detect a contradiction

Test Case 8 - Tent Pair
GGG
TTG
GGG

  • Checks that the rule is valid for both tents, as neither has an adjacent tree

Too Few Tents Contradiction Rule - TREE-CONT-0003

Test Case 1 - Missing One Without Tent
G 0
1

  • Checks that the rule correctly identifies a missing tent

Test Case 2 - Missing One With Tent
T 0
2

  • Checks that the rule correctly identifies a missing tent

Test Case 3 - Both Axis Fail
G 1
1

  • Checks that the rule correctly identifies a missing tent

Test Case 4 - Missing Second Column
XR 0
XG 0
01

  • Checks that the rule correctly identifies a missing tent

Test Case 5 - Missing First Row
RG 1
XX 0
00

  • Checks that the rule correctly identifies a missing tent

Test Case 6 - Missing Middle Column
XRX 0
XGX 0
XGX 0
010

  • Checks that the rule correctly identifies a missing tent

Test Case 7 - Missing First Two Columns
GRG 0
GXG 0
GRG 0
101

  • Checks that the rule correctly identifies two missing tents

Test Case 8 - No Contradiction
TX 1
RX 0
10

  • Checks that the rule does not erroneously detect a contradiction

Too Many Tents Contradiction Rule - TREE-CONT-0004

All test cases use the same board but with different row/column rules

Test Case 1 - Expected No Tents
XTX 0
XRX 0
XXT 0
000

  • Checks that the rule correctly identifies too many tents everywhere except (0, 1)

Test Case 2 - First Row Tent
XTX 1
XRX 0
XXT 0
000

  • Checks that the rule correctly identifies too many tents everywhere except (0, 0) and (0, 1)

Test Case 3 - Last Row Tent
XTX 0
XRX 0
XXT 1
000

  • Checks that the rule correctly identifies too many tents everywhere except (0, 1) and (0, 2)

Test Case 4 - Central Column Tent
XTX 0
XRX 0
XXT 0
010

  • Checks that the rule correctly identifies too many tents everywhere except (0, 1) and (1, 1)

Test Case 4 - Last Column Tent
XTX 0
XRX 0
XXT 0
001

  • Checks that the rule correctly identifies too many tents everywhere except (0, 1) and (2, 1)

Test Case 5 - Valid Top Tent Invalid Bottom Tent XTX 1
XRX 0
XXT 0
001

  • Checks that the rule correctly identifies too many tents when the bottom right tent is in the row/column

Test Case 6 - Valid Bottom Tent Invalid Top Tent XTX 0
XRX 0
XXT 1
001

  • Checks that the rule correctly identifies too many tents when the top tent is in the row/column

Touching Tents Contradiction Rule - TREE-CONT-0005

Test Case 1 - Diagonally Touching Tents
TX
XT

  • Checks that the rule detects diagonal touching tents

Test Case 2 - Diagonally Touching Tents
XT
TX

  • Checks that the rule detects diagonal touching tents

Test Case 3 - Vertically Adjacent Tents
TX
TX

  • Checks that the rule detects vertically adjacent tents

Test Case 4 - Horizontally Adjacent Tents
TT
XX

  • Checks that the rule detects horizontally adjacent tents

Test Case 5 - Full 2x2
TT
TT

  • Checks that the rule detects a contradiction

Test Case 6 - Adjacent Tree
TR
XX

  • Checks that the rule does not erroneously detect a contradiction

Test Case 7 - Diagonal Tree
TX
XR

  • Checks that the rule does not erroneously detect a contradiction

Case Rule Tests

Fill In Row Case Rule - TREE-CASE-0001

Note: The rule is somewhat smart; it does not create cases where two tents are next to each other, which would fail the Touching Tents contradiction rule.
Every test case also tests the equivalent column call, but only the cases for one direction are generated.

Test Case 1 - Zero Tent Clue

Input Board:
XXX x
XXX 0
XXX x
x0x

Generated Boards:
XXX x
GGG 0
XXX x
x0x

  • Checks that the case rule creates one case that is the equivalent of the Fill with Grass Direct Rule

Test Case 2 - One Tent Clue

Input Board:
XXX x
XXX 1
XXX x
x1x

Generated Boards:
XXX x
TGG 1
XXX x
xxx

XXX x
GTG 1
XXX x
xxx

XXX x
GGT 1
XXX x
xxx

  • Checks that three cases are created, each having one tent in the row
  • Checks that all other cells are untouched.

Test Case 3 - Two Tent Clue

Input Board:
XXX x
XXX 2
XXX x
xxx

Generated Boards:
XXX x
TGT 2
XXX x
xxx

  • Checks that one case is created, where the outer two columns hold the tents.
  • Checks that all other cells are untouched.

Test Case 4 - Three Tent Clue

Input Board:
XXX x
XXX 3
XXX x
xxx

Generated Boards:
null

  • Checks that no cases are created, as the only case would result in touching tents.

Test Case 5 - Larger Two Tent Clue

Input Board:
XXXXX x
XXXXX x
XXXXX 2
XXXXX x
XXXXX x
xx2xx

Generated Boards:
XXXXX x
XXXXX x
TGTGG 2
XXXXX x
XXXXX x
xx2xx

XXXXX x
XXXXX x
TGGTG 2
XXXXX x
XXXXX x
xx2xx

XXXXX x
XXXXX x
TGGGT 2
XXXXX x
XXXXX x
xx2xx

XXXXX x
XXXXX x
GTGTG 2
XXXXX x
XXXXX x
xx2xx

XXXXX x
XXXXX x
GTGGT 2
XXXXX x
XXXXX x
xx2xx

XXXXX x
XXXXX x
GGTGT 2
XXXXX x
XXXXX x
xx2xx

  • Checks that six cases are created, each having two tents in the central row.
  • Checks that all other cells are untouched.

Test Case 6 - Partially Filled Column

Input Board:
XGX x
XXX x
XGX x
XXX x
XGX x
XXX x
XGX x
x3x

Generated Boards:
XGX x
XTX x
XGX x
XTX x
XRX x
XTX x
XRX x
x3x

  • Checks that one case is created, where all unknown tiles are replaced with a tent.
  • Checks that all other cells are untouched.

Link Tent Case Rule - TREE-CASE-0002

Test Case 1 - One Tree

Input Board:
XRX
XTX
XXX

Generated Boards:
Line connecting (1, 0) and (1, 1)

  • Checks that one case is created which links the tent to the tree.
  • Checks that all cells are untouched.

Test Case 2 - Four Trees

Input Board:
XRX
RTR
XRX

Generated Boards:
Line connecting (1, 0) and (1, 1)

Line connecting (0, 1) and (1, 1)

Line connecting (1, 2) and (1, 1)

Line connecting (2, 1) and (1, 1)

  • Checks that four cases are created, each linking the tree to one tent.
  • Checks that all cells are untouched.

Test Case 3 - No Trees

Input Board:
XXX
XTX
XXX

Generated Boards:
null

  • Checks that no cases are created.

Test Case 4 - Diagonal Trees

Input Board:
RXR
XTX
RXR

Generated Boards:
null

  • Checks that the rule does not link to diagonal trees.

Link Tree Case Rule - TREE-CASE-0003

Test Case 1 - One Tent

Input Board:
XTX
XRX
XXX

Generated Boards:
Line connecting (1, 0) and (1, 1)

  • Checks that one case is created which links the tree to the tent.
  • Checks that all cells are untouched.

Test Case 2 - Two Tents

Input Board:
XTX
XRX
XTX

Generated Boards:
Line connecting (1, 0) and (1, 1)

Line connecting (1, 2) and (1, 1)

  • Checks that two cases are created, linking the tree to one tent.
  • Checks that all cells are untouched.

Test Case 3 - No Tents

Input Board:
XXX
XRX
XXX

Generated Boards:
null

  • Checks that no cases are created.

Test Case 4 - Diagonal Tents

Input Board:
TXT
XRX
TXT

Generated Boards:
null

  • Checks that the rule does not link to diagonal tents.

Tent or Grass Case Rule - TREE-CASE-0004

Test Case 1 - Simple Tent or Grass

Input Board:
XXX
XXX
XXX

Generated Boards:
TXX
XXX
XXX

RXX
XXX
XXX

  • Checks that the rule correctly generates two boards the same size as the initial board.
  • Checks that the two boards are identical except for cell (0,0) which must be a tree or a tent.
  • Checks that (0,0) is different for both boards.
Clone this wiki locally