summaryrefslogtreecommitdiff
path: root/core/src/test/scala/forge/TarjanTests.scala
diff options
context:
space:
mode:
authorLi Haoyi <haoyi.sg@gmail.com>2017-11-10 20:52:57 -0800
committerLi Haoyi <haoyi.sg@gmail.com>2017-11-10 20:52:57 -0800
commit337508c82cbe598b8796fc532cd92e8230b099cb (patch)
tree8e1732b4978a7d9e40dc545bb1dd1fdc8acdf2e9 /core/src/test/scala/forge/TarjanTests.scala
parent79bfb324a231bb3f46a180039b6d68ca042f181b (diff)
downloadmill-337508c82cbe598b8796fc532cd92e8230b099cb.tar.gz
mill-337508c82cbe598b8796fc532cd92e8230b099cb.tar.bz2
mill-337508c82cbe598b8796fc532cd92e8230b099cb.zip
rename forge -> mill
Diffstat (limited to 'core/src/test/scala/forge/TarjanTests.scala')
-rw-r--r--core/src/test/scala/forge/TarjanTests.scala90
1 files changed, 0 insertions, 90 deletions
diff --git a/core/src/test/scala/forge/TarjanTests.scala b/core/src/test/scala/forge/TarjanTests.scala
deleted file mode 100644
index 58032b86..00000000
--- a/core/src/test/scala/forge/TarjanTests.scala
+++ /dev/null
@@ -1,90 +0,0 @@
-package forge
-import forge.eval.Tarjans
-import utest._
-object TarjanTests extends TestSuite{
- def check(input: Seq[Seq[Int]], expected: Seq[Seq[Int]]) = {
- val result = Tarjans(input).map(_.sorted)
- val sortedExpected = expected.map(_.sorted)
- assert(result == sortedExpected)
- }
- val tests = Tests{
- //
- 'empty - check(Seq(), Seq())
-
- // (0)
- 'singleton - check(Seq(Seq()), Seq(Seq(0)))
-
-
- // (0)-.
- // ^._/
- 'selfCycle - check(Seq(Seq(0)), Seq(Seq(0)))
-
- // (0) <-> (1)
- 'simpleCycle- check(Seq(Seq(1), Seq(0)), Seq(Seq(1, 0)))
-
- // (0) (1) (2)
- 'multipleSingletons - check(
- Seq(Seq(), Seq(), Seq()),
- Seq(Seq(0), Seq(1), Seq(2))
- )
-
- // (0) -> (1) -> (2)
- 'straightLineNoCycles- check(
- Seq(Seq(1), Seq(2), Seq()),
- Seq(Seq(2), Seq(1), Seq(0))
- )
-
- // (0) <- (1) <- (2)
- 'straightLineNoCyclesReversed- check(
- Seq(Seq(), Seq(0), Seq(1)),
- Seq(Seq(0), Seq(1), Seq(2))
- )
-
- // (0) <-> (1) (2) -> (3) -> (4)
- // ^.____________/
- 'independentSimpleCycles - check(
- Seq(Seq(1), Seq(0), Seq(3), Seq(4), Seq(2)),
- Seq(Seq(1, 0), Seq(4, 3, 2))
- )
-
- // ___________________
- // v \
- // (0) <-> (1) (2) -> (3) -> (4)
- // ^.____________/
- 'independentLinkedCycles - check(
- Seq(Seq(1), Seq(0), Seq(3), Seq(4), Seq(2, 1)),
- Seq(Seq(1, 0), Seq(4, 3, 2))
- )
- // _____________
- // / v
- // (0) <-> (1) (2) -> (3) -> (4)
- // ^.____________/
- 'independentLinkedCycles2 - check(
- Seq(Seq(1, 2), Seq(0), Seq(3), Seq(4), Seq(2)),
- Seq(Seq(4, 3, 2), Seq(1, 0))
- )
-
- // _____________
- // / v
- // (0) <-> (1) (2) -> (3) -> (4)
- // ^. ^.____________/
- // \________________/
- 'combinedCycles - check(
- Seq(Seq(1, 2), Seq(0), Seq(3), Seq(4), Seq(2, 1)),
- Seq(Seq(4, 3, 2, 1, 0))
- )
- //
- // (0) <-> (1) <- (2) <- (3) <-> (4) <- (5)
- // ^.____________/ / /
- // / /
- // (6) <- (7) <-/ (8) <-'
- // / /
- // v /
- // (9) <--------'
- 'combinedCycles - check(
- Seq(Seq(1), Seq(0), Seq(0, 1), Seq(2, 4, 7, 9), Seq(3), Seq(4, 8), Seq(9), Seq(6), Seq(), Seq()),
- Seq(Seq(0, 1), Seq(2), Seq(9), Seq(6), Seq(7), Seq(3, 4), Seq(8), Seq(5))
- )
-
- }
-} \ No newline at end of file