These numbers are taken from the FastParse test suite, which runs over the following libraries:
- fastparse
- scalaJs
- scalaz
- shapeless
- akka
- lift
- play
- PredictionIO
| import utest._ | |
| object Tests extends TestSuite | |
| val tests = TestSuite do | |
| 'simple do | |
| 'class-assert((new scalite.simple.Class)() == "Hello World!12") | |
| 'assignments-assert((new scalite.simple.Assignments)() == 9) | |
| 'modassignments-assert((new scalite.simple.ModAssignments)() == 9) | |
| 'ifelsewhile-assert((new scalite.simple.IfElseWhile)() == 40) | |
| 'ifelsewhilelite-assert((new scalite.simple.IfElseWhileLite)() == 36) |
| package com.example | |
| import akka.actor.Actor | |
| import spray.routing._ | |
| import spray.http._ | |
| import MediaTypes._ | |
| // we don't implement our route structure directly in the service actor because | |
| // we want to be able to test it independently, without having to spin up an actor |
| package com.example | |
| import akka.actor.Actor | |
| import spray.routing._ | |
| import spray.http._ | |
| import MediaTypes._ | |
| // we don't implement our route structure directly in the service actor because | |
| // we want to be able to test it independently, without having to spin up an actor |
| def words(s: String): Set[String] | |
| def makeWordMap(sentences: List[String]) = { | |
| val forwardMap = sentences.map(s => (s, words(s))).toMap | |
| sentences.flatMap(words) | |
| .distinct | |
| .map(w => sentences.filter(forwardMap(s))) | |
| } | |
| def makeWordMap2(sentences: List[String]) = { |
| package ammonite.sh2 | |
| import acyclic.file | |
| import scala.collection.{immutable => imm} | |
| object PConfig{ | |
| implicit val pc = new PConfig() | |
| } | |
| case class PConfig(maxDepth: Int = 100, depth: Int = 0) | |
| object PPrint extends LowPriPPrint{ |
| [info] Running ammonite.repl.Repl | |
| @ Range(0, 5).ma | |
| max map maxBy | |
| @ while(true) () | |
| Interrupted! | |
| @ val x = 1 | |
| x: Int = 1 | |
| @ val y = 2 | |
| y: Int = 2 |
| // Input Scala sources | |
| def lightIsVisible(l: Vec, p: Vec) = { | |
| val ray = Ray(p, l - p) | |
| val length = (l - p).magnitude | |
| var visible = true | |
| for (i <- 0 until objects.length){ | |
| val (o, s) = objects(i) | |
| val t = o.intersectionTime(ray) | |
| if (t > Epsilon && t < length - Epsilon){ | |
| visible = false |
| haoyi-mbp:workbench-example-app haoyi$ cat ~/Dropbox\ \(Personal\)/Archive/Coding/scala-js-docs/build.sbt | |
| libraryDependencies += "org.jsoup" % "jsoup" % "1.7.3" | |
| haoyi-mbp:workbench-example-app haoyi$ cat ~/Dropbox\ \(Personal\)/Archive/Coding/scala-js-docs/src/main/scala/Main.scala | |
| import java.io.File | |
| import org.jsoup.Jsoup | |
| import org.jsoup.nodes.Document | |
| import scala.io.Source | |
| import collection.mutable |
| val space = R( CharSets(" \n").rep1 ) | |
| val digits = R( CharSets('0' to '9').rep1 ) | |
| val exponent = R( CharSets("eE") ~ CharSets("+-").? ~ digits ) | |
| val fractional = R( "." ~ digits ) | |
| val integral = R( "0" | CharSets('1' to '9') ~ digits.rep ) | |
| val number = R( "?".? ~ integral ~ fractional.? ~ exponent.? ) | |
| val `null` = R( "null" ) | |
| val `false` = R( "false" ) | |
| val `true` = R( "true" ) | |
| val hexDigit = R( CharSets('0'to'9', 'a'to'f', 'A'to'F') ) |
These numbers are taken from the FastParse test suite, which runs over the following libraries: