Last active
May 25, 2024 10:20
-
-
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/490c9dca0772d538749f512c2ed9f40b31a5c6c3
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 NON-AI License Version 2.0 (https://raw.githubusercontent.com/non-ai-licenses/non-ai-licenses/main/NON-AI-APACHE2) | |
// 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