diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-06-18 10:41:49 -0700 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-06-18 10:41:49 -0700 |
commit | 97271ef9f75296d6b3b5ef10ec361c70591a6a27 (patch) | |
tree | d7fc44bc085f60dc7fdffa30a90de2ffcb39c782 /test/files | |
parent | 9736f97a9765dade23fef7131fa9b34229b5feef (diff) | |
parent | e3d3e1665d150869be4be40b9ce42690e9e9d247 (diff) | |
download | scala-97271ef9f75296d6b3b5ef10ec361c70591a6a27.tar.gz scala-97271ef9f75296d6b3b5ef10ec361c70591a6a27.tar.bz2 scala-97271ef9f75296d6b3b5ef10ec361c70591a6a27.zip |
Merge pull request #2602 from t3hnar/Duration.toCoarsest
Add Duration.toCoarsest method
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/run/duration-coarsest.scala | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/files/run/duration-coarsest.scala b/test/files/run/duration-coarsest.scala new file mode 100644 index 0000000000..51cb79287a --- /dev/null +++ b/test/files/run/duration-coarsest.scala @@ -0,0 +1,28 @@ +import scala.concurrent.duration._ +import scala.language.postfixOps + +object Test extends App { + List( + (60 minutes, 1 hour), + (2000 millis, 2 seconds), + (2000 micros, 2 millis), + (2000 nanos, 2 micros), + (2000000 nanos, 2 millis), + (48 hours, 2 days), + (5 seconds, 5 seconds), + (1 second, 1 second) + ) foreach { + case (x, expected) => + val actual = x.toCoarsest + assert(actual.unit == expected.unit, s"$actual, $expected") + assert(actual.length == expected.length, s"$actual, $expected") + } + + List( + 45 minutes, + 500 millis, + 1500 millis, + 23 hours, + 40 days + ) foreach (x => assert(x == x.toCoarsest, x)) +}
\ No newline at end of file |