Last active
May 27, 2023 06:28
-
-
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/4706e7cd7cb6139853cdf1a8d6c35656d8bff8c2
This file contains 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.3.0" | |
//> 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