Skip to content

Instantly share code, notes, and snippets.

@ttencate
Created June 28, 2017 12:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ttencate/eee9b56186c118d592eb83fbd2b11f15 to your computer and use it in GitHub Desktop.
Save ttencate/eee9b56186c118d592eb83fbd2b11f15 to your computer and use it in GitHub Desktop.
@Test
fun forceMovesObject() = physicsTest {
- " "
- " A "
- " "
A isPushed right
A shouldMove right
}
@Test
fun objectPushesObject() = physicsTest {
- " "
- " AB "
- " "
A isPushed right
A shouldMove right
B shouldMove right
}
@Test
fun objectBlockedByWall() = physicsTest {
- " "
- " A# "
- " "
A isPushed right
A shouldMove nowhere
}
@Test
fun forcesCancel() = physicsTest {
- " "
- " AB "
- " "
A isPushed right
B isPushed left
A shouldMove nowhere
B shouldMove nowhere
}
@Test
fun bothPushed() = physicsTest {
- " "
- " AB "
- " "
A isPushed right
B isPushed right
A shouldMove right
B shouldMove right
}
@Test
fun forcesAddUp() = physicsTest {
- " "
- " ABC "
- " "
A isPushed right
B isPushed right
C isPushed left
A shouldMove right
B shouldMove right
C shouldMove right
}
@Test
fun forceTransferredToMultipleObjects() = physicsTest {
- " "
- " B D "
- " ABCD "
- " D "
- " "
A isPushed right
A shouldMove right
B shouldMove right
C shouldMove right
D shouldMove right
}
@Test
fun multipleObjectsBlockedByWall() = physicsTest {
- " "
- " B#D "
- " ABCD "
- " D "
- " "
A isPushed right
A shouldMove nowhere
B shouldMove nowhere
C shouldMove nowhere
D shouldMove nowhere
}
@Test
fun longObject() = physicsTest {
- " "
- " BBBB "
- " A "
- " "
A isPushed up
A shouldMove up
B shouldMove up
}
@Test
fun interlocked() = physicsTest {
- " "
- " BBB "
- " ABCBC "
- " CCC "
- " "
A isPushed right
A shouldMove right
B shouldMove right
C shouldMove right
}
@Test
fun blockedHalfway() = physicsTest {
- " "
- " B# "
- " ABC "
- " "
A isPushed right
A shouldMove nowhere
B shouldMove nowhere
C shouldMove nowhere
}
@Test
fun parallelPushers() = physicsTest {
- " "
- " AB "
- " B "
- " CB "
- " "
A isPushed right
C isPushed right
A shouldMove right
B shouldMove right
C shouldMove right
}
@Test
fun multipleForces() = physicsTest {
- " "
- " ABC "
- " "
A isPushed right
A isPushed right
A shouldMove right
B shouldMove right
C shouldMove right
}
@Test
fun orthogonalForces() = physicsTest {
- " "
- " AB "
- " C "
- " D "
- " "
A isPushed right
C isPushed up
D isPushed up
A shouldMove nowhere
B shouldMove up
C shouldMove up
D shouldMove up
}
@Test
fun noPulling() = physicsTest {
- " "
- " ZAB "
- " B "
- " CBD "
- " "
Z isPushed right
A isPushed right
C isPushed left
D isPushed left
Z shouldMove right
A shouldMove right
B shouldMove right
C shouldMove left
D shouldMove right
}
@Test
fun pushIntoTwoWalls() = physicsTest {
- " "
- " #A "
- " A "
- " %A "
- " "
A isPushed left
A shouldMove nowhere
}
@Test
fun pushIntoWallIndirectly() = physicsTest {
- " "
- " #BA "
- " ##A "
- " "
A isPushed left
A shouldMove nowhere
B shouldMove nowhere
}
@Test
fun wallForceZero() = physicsTest {
- " "
- " AB "
- " A# "
- " "
A isPushed right
B isPushed left
A shouldMove nowhere
B shouldMove nowhere
}
@Test
fun noWallPulling() = physicsTest {
- " "
- " ABC "
- " A# "
- " "
A isPushed right
B isPushed left
C isPushed left
A shouldMove left
B shouldMove left
C shouldMove left
}
@Test
fun cancelWithThirdBlock() = physicsTest {
- " "
- " AB "
- " AC "
- " "
A isPushed right
C isPushed left
A shouldMove nowhere
B shouldMove nowhere
C shouldMove nowhere
}
@Test
fun noDiagonalOverlap() = physicsTest {
- " "
- " AB "
- " "
A isPushed right
B isPushed up
either {
A shouldMove right
B shouldMove right
}
or {
A shouldMove nowhere
B shouldMove up
}
}
@Test
fun horizontalVerticalAmbiguity() = physicsTest {
- " "
- " "
- " AB "
- " C "
- " "
A isPushed right
C isPushed up
either {
A shouldMove right
B shouldMove right
C shouldMove nowhere
}
or {
A shouldMove nowhere
B shouldMove up
C shouldMove up
}
}
@Test
fun sameDestinationAmbiguity() = physicsTest {
- " "
- " A B "
- " "
A isPushed right
B isPushed left
either {
A shouldMove right
B shouldMove nowhere
}
or {
A shouldMove nowhere
B shouldMove left
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment