diff options
author | Roland <rk@rkuhn.info> | 2012-09-07 21:35:17 +0200 |
---|---|---|
committer | Roland <rk@rkuhn.info> | 2012-09-07 21:35:17 +0200 |
commit | f41d3ade90c3cfee772b6475eca7350883b81e2c (patch) | |
tree | 25f735a5fe90304c235ca098a229265e12291381 /test | |
parent | 7a833f94296849c0e2a6cbacb7e513599c831f38 (diff) | |
download | scala-f41d3ade90c3cfee772b6475eca7350883b81e2c.tar.gz scala-f41d3ade90c3cfee772b6475eca7350883b81e2c.tar.bz2 scala-f41d3ade90c3cfee772b6475eca7350883b81e2c.zip |
fix some one more issue in Duration
- Inf / Zero == Inf
- add some more missing test cases
- clarify magic constant
- move exception descriptions into proper @throws docs
Diffstat (limited to 'test')
-rw-r--r-- | test/files/jvm/duration-tck.scala | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/test/files/jvm/duration-tck.scala b/test/files/jvm/duration-tck.scala index aa1ac50078..87ffa196ca 100644 --- a/test/files/jvm/duration-tck.scala +++ b/test/files/jvm/duration-tck.scala @@ -88,6 +88,7 @@ object Test extends App { inputs filterNot (_.isFinite) foreach (x => x / zero mustBe x.toUnit(DAYS)) inputs filterNot (_.isFinite) foreach (_ * 0d mustBe undef) + inputs filterNot (_.isFinite) foreach (_ * -0d mustBe undef) inputs filterNot (_.isFinite) foreach (x => x * Double.PositiveInfinity mustBe x) inputs filterNot (_.isFinite) foreach (x => x * Double.NegativeInfinity mustBe -x) @@ -112,7 +113,13 @@ object Test extends App { inputs foreach (undef + _ mustBe undef) inputs foreach (undef - _ mustBe undef) inputs foreach (undef / _ mustBe nan) - inputs filter (_.isFinite) foreach (x => x / zero mustBe x.toUnit(SECONDS) / 0d) + undef / 1 mustBe undef + undef / nan mustBe undef + undef * 1 mustBe undef + undef * nan mustBe undef + inputs foreach (x => x / zero mustBe x.toUnit(SECONDS) / 0d) + inputs foreach (x => x / 0d mustBe Duration.fromNanos(x.toUnit(NANOSECONDS) / 0d)) + inputs foreach (x => x / -0d mustBe Duration.fromNanos(x.toUnit(NANOSECONDS) / -0d)) inputs filterNot (_ eq undef) foreach (_ compareTo undef mustBe -1) inputs filterNot (_ eq undef) foreach (undef compareTo _ mustBe 1) @@ -170,12 +177,11 @@ object Test extends App { // test Deadline val dead = 2.seconds.fromNow val dead2 = 2 seconds fromNow - // view bounds vs. very local type inference vs. operator precedence: sigh - assert(dead.timeLeft > (1 second: Duration)) - assert(dead2.timeLeft > (1 second: Duration)) + assert(dead.timeLeft > 1.second) + assert(dead2.timeLeft > 1.second) Thread.sleep(1.second.toMillis) - assert(dead.timeLeft < (1 second: Duration)) - assert(dead2.timeLeft < (1 second: Duration)) + assert(dead.timeLeft < 1.second) + assert(dead2.timeLeft < 1.second) // check statically retaining finite-ness |