Last active
February 3, 2026 20:25
-
-
Save dacr/fa515384be730103dbd37e7b3815b58f to your computer and use it in GitHub Desktop.
simple scalatest test framework usage with durations. / published by https://github.com/dacr/code-examples-manager #71184017-0b75-49fe-8acb-1e4f255d9d11/9828f633061b65df5208e3953405bb3b918abdbe
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // summary : simple scalatest test framework usage with durations. | |
| // keywords : scala, scalatest, pi, @testable, duration | |
| // publish : gist | |
| // authors : David Crosson | |
| // license : Apache License Version 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt) | |
| // id : 71184017-0b75-49fe-8acb-1e4f255d9d11 | |
| // created-on : 2020-10-11T15:05:16Z | |
| // managed-by : https://github.com/dacr/code-examples-manager | |
| // run-with : scala-cli $file | |
| // --------------------- | |
| //> using scala "3.4.2" | |
| //> using dep "org.scalatest::scalatest:3.2.16" | |
| //> using objectWrapper | |
| // --------------------- | |
| import org.scalatest.*, flatspec.*, matchers.* | |
| class PiTest extends AnyFlatSpec with should.Matchers { | |
| "pi calculus" should "return a precise enough pi value" in { | |
| math.Pi shouldBe 3.14158d +- 0.001d | |
| } | |
| } | |
| org.scalatest.tools.Runner.main(Array("-oDF", "-s", classOf[PiTest].getName)) | |
| //org.scalatest.tools.Runner.main(Array("-oDF", "-s", "testing$minuspi$minus2$_$PiTest")) | |
| //(new PiTest).execute() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment