diff options
author | Paul Phillips <paulp@improving.org> | 2012-09-04 22:54:43 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-09-04 22:54:43 -0700 |
commit | adf2d3632b07eef4fc2303aef994e66584a73f49 (patch) | |
tree | 3f4d0f74f0ebd341fb453fd6a07d31e17423b4d2 /test | |
parent | 9556dfbf9dbb1b129b5eaab577d90cf09206ed4d (diff) | |
parent | 5b9b394d99bd7e4446e0f15475b34ec287d91685 (diff) | |
download | scala-adf2d3632b07eef4fc2303aef994e66584a73f49.tar.gz scala-adf2d3632b07eef4fc2303aef994e66584a73f49.tar.bz2 scala-adf2d3632b07eef4fc2303aef994e66584a73f49.zip |
Merge pull request #1253 from paulp/topic/fix-duration
Removing duplication from Duration.
Diffstat (limited to 'test')
-rw-r--r-- | test/files/jvm/duration-java.check | 362 | ||||
-rw-r--r-- | test/files/jvm/duration-java/Test.java | 38 |
2 files changed, 400 insertions, 0 deletions
diff --git a/test/files/jvm/duration-java.check b/test/files/jvm/duration-java.check new file mode 100644 index 0000000000..7ae257dcc0 --- /dev/null +++ b/test/files/jvm/duration-java.check @@ -0,0 +1,362 @@ + 0.0 nanoseconds => 0 days + 1.0 nanoseconds => 1 nanosecond + 7.0 nanoseconds => 7 nanoseconds + 10.0 nanoseconds => 10 nanoseconds + 12.0 nanoseconds => 12 nanoseconds + 24.0 nanoseconds => 24 nanoseconds + 30.0 nanoseconds => 30 nanoseconds + 49.0 nanoseconds => 49 nanoseconds + 60.0 nanoseconds => 60 nanoseconds + 70.0 nanoseconds => 70 nanoseconds + 84.0 nanoseconds => 84 nanoseconds + 100.0 nanoseconds => 100 nanoseconds + 120.0 nanoseconds => 120 nanoseconds + 144.0 nanoseconds => 144 nanoseconds + 168.0 nanoseconds => 168 nanoseconds + 210.0 nanoseconds => 210 nanoseconds + 240.0 nanoseconds => 240 nanoseconds + 288.0 nanoseconds => 288 nanoseconds + 300.0 nanoseconds => 300 nanoseconds + 360.0 nanoseconds => 360 nanoseconds + 420.0 nanoseconds => 420 nanoseconds + 576.0 nanoseconds => 576 nanoseconds + 600.0 nanoseconds => 600 nanoseconds + 700.0 nanoseconds => 700 nanoseconds + 720.0 nanoseconds => 720 nanoseconds + 900.0 nanoseconds => 900 nanoseconds + 1000.0 nanoseconds => 1 microsecond + 1200.0 nanoseconds => 1200 nanoseconds + 1440.0 nanoseconds => 1440 nanoseconds + 1800.0 nanoseconds => 1800 nanoseconds + 2400.0 nanoseconds => 2400 nanoseconds + 3000.0 nanoseconds => 3 microseconds + 3600.0 nanoseconds => 3600 nanoseconds + 6000.0 nanoseconds => 6 microseconds + 7000.0 nanoseconds => 7 microseconds + 10000.0 nanoseconds => 10 microseconds + 12000.0 nanoseconds => 12 microseconds + 24000.0 nanoseconds => 24 microseconds + 30000.0 nanoseconds => 30 microseconds + 60000.0 nanoseconds => 60 microseconds + 100000.0 nanoseconds => 100 microseconds + 1000000.0 nanoseconds => 1 millisecond + 7000000.0 nanoseconds => 7 milliseconds + 1.0E7 nanoseconds => 10 milliseconds + 1.2E7 nanoseconds => 12 milliseconds + 2.4E7 nanoseconds => 24 milliseconds + 3.0E7 nanoseconds => 30 milliseconds + 6.0E7 nanoseconds => 60 milliseconds + 1.0E8 nanoseconds => 100 milliseconds + 1.0E9 nanoseconds => 1 second + 1.0E12 nanoseconds => 1000 seconds + 0.0 microseconds => 0 days + 1.0 microseconds => 1 microsecond + 7.0 microseconds => 7 microseconds + 10.0 microseconds => 10 microseconds + 12.0 microseconds => 12 microseconds + 24.0 microseconds => 24 microseconds + 30.0 microseconds => 30 microseconds + 49.0 microseconds => 49 microseconds + 60.0 microseconds => 60 microseconds + 70.0 microseconds => 70 microseconds + 84.0 microseconds => 84 microseconds + 100.0 microseconds => 100 microseconds + 120.0 microseconds => 120 microseconds + 144.0 microseconds => 144 microseconds + 168.0 microseconds => 168 microseconds + 210.0 microseconds => 210 microseconds + 240.0 microseconds => 240 microseconds + 288.0 microseconds => 288 microseconds + 300.0 microseconds => 300 microseconds + 360.0 microseconds => 360 microseconds + 420.0 microseconds => 420 microseconds + 576.0 microseconds => 576 microseconds + 600.0 microseconds => 600 microseconds + 700.0 microseconds => 700 microseconds + 720.0 microseconds => 720 microseconds + 900.0 microseconds => 900 microseconds + 1000.0 microseconds => 1 millisecond + 1200.0 microseconds => 1200 microseconds + 1440.0 microseconds => 1440 microseconds + 1800.0 microseconds => 1800 microseconds + 2400.0 microseconds => 2400 microseconds + 3000.0 microseconds => 3 milliseconds + 3600.0 microseconds => 3600 microseconds + 6000.0 microseconds => 6 milliseconds + 7000.0 microseconds => 7 milliseconds + 10000.0 microseconds => 10 milliseconds + 12000.0 microseconds => 12 milliseconds + 24000.0 microseconds => 24 milliseconds + 30000.0 microseconds => 30 milliseconds + 60000.0 microseconds => 60 milliseconds + 100000.0 microseconds => 100 milliseconds + 1000000.0 microseconds => 1 second + 7000000.0 microseconds => 7 seconds + 1.0E7 microseconds => 10 seconds + 1.2E7 microseconds => 12 seconds + 2.4E7 microseconds => 24 seconds + 3.0E7 microseconds => 30 seconds + 6.0E7 microseconds => 1 minute + 1.0E8 microseconds => 100 seconds + 1.0E9 microseconds => 1000 seconds + 1.0E12 microseconds => 1000000 seconds + 0.0 milliseconds => 0 days + 1.0 milliseconds => 1 millisecond + 7.0 milliseconds => 7 milliseconds + 10.0 milliseconds => 10 milliseconds + 12.0 milliseconds => 12 milliseconds + 24.0 milliseconds => 24 milliseconds + 30.0 milliseconds => 30 milliseconds + 49.0 milliseconds => 49 milliseconds + 60.0 milliseconds => 60 milliseconds + 70.0 milliseconds => 70 milliseconds + 84.0 milliseconds => 84 milliseconds + 100.0 milliseconds => 100 milliseconds + 120.0 milliseconds => 120 milliseconds + 144.0 milliseconds => 144 milliseconds + 168.0 milliseconds => 168 milliseconds + 210.0 milliseconds => 210 milliseconds + 240.0 milliseconds => 240 milliseconds + 288.0 milliseconds => 288 milliseconds + 300.0 milliseconds => 300 milliseconds + 360.0 milliseconds => 360 milliseconds + 420.0 milliseconds => 420 milliseconds + 576.0 milliseconds => 576 milliseconds + 600.0 milliseconds => 600 milliseconds + 700.0 milliseconds => 700 milliseconds + 720.0 milliseconds => 720 milliseconds + 900.0 milliseconds => 900 milliseconds + 1000.0 milliseconds => 1 second + 1200.0 milliseconds => 1200 milliseconds + 1440.0 milliseconds => 1440 milliseconds + 1800.0 milliseconds => 1800 milliseconds + 2400.0 milliseconds => 2400 milliseconds + 3000.0 milliseconds => 3 seconds + 3600.0 milliseconds => 3600 milliseconds + 6000.0 milliseconds => 6 seconds + 7000.0 milliseconds => 7 seconds + 10000.0 milliseconds => 10 seconds + 12000.0 milliseconds => 12 seconds + 24000.0 milliseconds => 24 seconds + 30000.0 milliseconds => 30 seconds + 60000.0 milliseconds => 1 minute + 100000.0 milliseconds => 100 seconds + 1000000.0 milliseconds => 1000 seconds + 7000000.0 milliseconds => 7000 seconds + 1.0E7 milliseconds => 10000 seconds + 1.2E7 milliseconds => 200 minutes + 2.4E7 milliseconds => 400 minutes + 3.0E7 milliseconds => 500 minutes + 6.0E7 milliseconds => 1000 minutes + 1.0E8 milliseconds => 100000 seconds + 1.0E9 milliseconds => 1000000 seconds + 1.0E12 milliseconds => 1000000000 seconds + 0.0 seconds => 0 days + 1.0 seconds => 1 second + 7.0 seconds => 7 seconds + 10.0 seconds => 10 seconds + 12.0 seconds => 12 seconds + 24.0 seconds => 24 seconds + 30.0 seconds => 30 seconds + 49.0 seconds => 49 seconds + 60.0 seconds => 1 minute + 70.0 seconds => 70 seconds + 84.0 seconds => 84 seconds + 100.0 seconds => 100 seconds + 120.0 seconds => 2 minutes + 144.0 seconds => 144 seconds + 168.0 seconds => 168 seconds + 210.0 seconds => 210 seconds + 240.0 seconds => 4 minutes + 288.0 seconds => 288 seconds + 300.0 seconds => 5 minutes + 360.0 seconds => 6 minutes + 420.0 seconds => 7 minutes + 576.0 seconds => 576 seconds + 600.0 seconds => 10 minutes + 700.0 seconds => 700 seconds + 720.0 seconds => 12 minutes + 900.0 seconds => 15 minutes + 1000.0 seconds => 1000 seconds + 1200.0 seconds => 20 minutes + 1440.0 seconds => 24 minutes + 1800.0 seconds => 30 minutes + 2400.0 seconds => 40 minutes + 3000.0 seconds => 50 minutes + 3600.0 seconds => 1 hour + 6000.0 seconds => 100 minutes + 7000.0 seconds => 7000 seconds + 10000.0 seconds => 10000 seconds + 12000.0 seconds => 200 minutes + 24000.0 seconds => 400 minutes + 30000.0 seconds => 500 minutes + 60000.0 seconds => 1000 minutes + 100000.0 seconds => 100000 seconds + 1000000.0 seconds => 1000000 seconds + 7000000.0 seconds => 7000000 seconds + 1.0E7 seconds => 10000000 seconds + 1.2E7 seconds => 200000 minutes + 2.4E7 seconds => 400000 minutes + 3.0E7 seconds => 500000 minutes + 6.0E7 seconds => 1000000 minutes + 1.0E8 seconds => 100000000 seconds + 1.0E9 seconds => 1000000000 seconds + 1.0E12 seconds => 9223372036854775807 nanoseconds + 0.0 minutes => 0 days + 1.0 minutes => 1 minute + 7.0 minutes => 7 minutes + 10.0 minutes => 10 minutes + 12.0 minutes => 12 minutes + 24.0 minutes => 24 minutes + 30.0 minutes => 30 minutes + 49.0 minutes => 49 minutes + 60.0 minutes => 1 hour + 70.0 minutes => 70 minutes + 84.0 minutes => 84 minutes + 100.0 minutes => 100 minutes + 120.0 minutes => 2 hours + 144.0 minutes => 144 minutes + 168.0 minutes => 168 minutes + 210.0 minutes => 210 minutes + 240.0 minutes => 4 hours + 288.0 minutes => 288 minutes + 300.0 minutes => 5 hours + 360.0 minutes => 6 hours + 420.0 minutes => 7 hours + 576.0 minutes => 576 minutes + 600.0 minutes => 10 hours + 700.0 minutes => 700 minutes + 720.0 minutes => 12 hours + 900.0 minutes => 15 hours + 1000.0 minutes => 1000 minutes + 1200.0 minutes => 20 hours + 1440.0 minutes => 1 day + 1800.0 minutes => 30 hours + 2400.0 minutes => 40 hours + 3000.0 minutes => 50 hours + 3600.0 minutes => 60 hours + 6000.0 minutes => 100 hours + 7000.0 minutes => 7000 minutes + 10000.0 minutes => 10000 minutes + 12000.0 minutes => 200 hours + 24000.0 minutes => 400 hours + 30000.0 minutes => 500 hours + 60000.0 minutes => 1000 hours + 100000.0 minutes => 100000 minutes + 1000000.0 minutes => 1000000 minutes + 7000000.0 minutes => 7000000 minutes + 1.0E7 minutes => 10000000 minutes + 1.2E7 minutes => 200000 hours + 2.4E7 minutes => 400000 hours + 3.0E7 minutes => 500000 hours + 6.0E7 minutes => 1000000 hours + 1.0E8 minutes => 100000000 minutes + 1.0E9 minutes => 9223372036854775807 nanoseconds + 1.0E12 minutes => 9223372036854775807 nanoseconds + 0.0 hours => 0 days + 1.0 hours => 1 hour + 7.0 hours => 7 hours + 10.0 hours => 10 hours + 12.0 hours => 12 hours + 24.0 hours => 1 day + 30.0 hours => 30 hours + 49.0 hours => 49 hours + 60.0 hours => 60 hours + 70.0 hours => 70 hours + 84.0 hours => 84 hours + 100.0 hours => 100 hours + 120.0 hours => 5 days + 144.0 hours => 6 days + 168.0 hours => 7 days + 210.0 hours => 210 hours + 240.0 hours => 10 days + 288.0 hours => 12 days + 300.0 hours => 300 hours + 360.0 hours => 15 days + 420.0 hours => 420 hours + 576.0 hours => 24 days + 600.0 hours => 25 days + 700.0 hours => 700 hours + 720.0 hours => 30 days + 900.0 hours => 900 hours + 1000.0 hours => 1000 hours + 1200.0 hours => 50 days + 1440.0 hours => 60 days + 1800.0 hours => 75 days + 2400.0 hours => 100 days + 3000.0 hours => 125 days + 3600.0 hours => 150 days + 6000.0 hours => 250 days + 7000.0 hours => 7000 hours + 10000.0 hours => 10000 hours + 12000.0 hours => 500 days + 24000.0 hours => 1000 days + 30000.0 hours => 1250 days + 60000.0 hours => 2500 days + 100000.0 hours => 100000 hours + 1000000.0 hours => 1000000 hours + 7000000.0 hours => 9223372036854775807 nanoseconds + 1.0E7 hours => 9223372036854775807 nanoseconds + 1.2E7 hours => 9223372036854775807 nanoseconds + 2.4E7 hours => 9223372036854775807 nanoseconds + 3.0E7 hours => 9223372036854775807 nanoseconds + 6.0E7 hours => 9223372036854775807 nanoseconds + 1.0E8 hours => 9223372036854775807 nanoseconds + 1.0E9 hours => 9223372036854775807 nanoseconds + 1.0E12 hours => 9223372036854775807 nanoseconds + 0.0 days => 0 days + 1.0 days => 1 day + 7.0 days => 7 days + 10.0 days => 10 days + 12.0 days => 12 days + 24.0 days => 24 days + 30.0 days => 30 days + 49.0 days => 49 days + 60.0 days => 60 days + 70.0 days => 70 days + 84.0 days => 84 days + 100.0 days => 100 days + 120.0 days => 120 days + 144.0 days => 144 days + 168.0 days => 168 days + 210.0 days => 210 days + 240.0 days => 240 days + 288.0 days => 288 days + 300.0 days => 300 days + 360.0 days => 360 days + 420.0 days => 420 days + 576.0 days => 576 days + 600.0 days => 600 days + 700.0 days => 700 days + 720.0 days => 720 days + 900.0 days => 900 days + 1000.0 days => 1000 days + 1200.0 days => 1200 days + 1440.0 days => 1440 days + 1800.0 days => 1800 days + 2400.0 days => 2400 days + 3000.0 days => 3000 days + 3600.0 days => 3600 days + 6000.0 days => 6000 days + 7000.0 days => 7000 days + 10000.0 days => 10000 days + 12000.0 days => 12000 days + 24000.0 days => 24000 days + 30000.0 days => 30000 days + 60000.0 days => 60000 days + 100000.0 days => 100000 days + 1000000.0 days => 9223372036854775807 nanoseconds + 7000000.0 days => 9223372036854775807 nanoseconds + 1.0E7 days => 9223372036854775807 nanoseconds + 1.2E7 days => 9223372036854775807 nanoseconds + 2.4E7 days => 9223372036854775807 nanoseconds + 3.0E7 days => 9223372036854775807 nanoseconds + 6.0E7 days => 9223372036854775807 nanoseconds + 1.0E8 days => 9223372036854775807 nanoseconds + 1.0E9 days => 9223372036854775807 nanoseconds + 1.0E12 days => 9223372036854775807 nanoseconds + Inf => Duration.Inf + -Inf => Duration.MinusInf + +Inf => Duration.Inf + PlusInf => Duration.Inf + MinusInf => Duration.MinusInf diff --git a/test/files/jvm/duration-java/Test.java b/test/files/jvm/duration-java/Test.java new file mode 100644 index 0000000000..02feb522b8 --- /dev/null +++ b/test/files/jvm/duration-java/Test.java @@ -0,0 +1,38 @@ +import scala.concurrent.util.Duration; +import java.util.*; +import java.util.concurrent.TimeUnit; +import static java.util.concurrent.TimeUnit.*; + +public class Test { + public static List<Double> inputs = Arrays.asList(0d, 1d, 7d, 10d, 12d, 24d, 30d, 60d, 100d, 1000d, 1e6); + public static List<Double> makeNumbers() { + ArrayList<Double> xs = new ArrayList<Double>(); + for (Double n1: inputs) { + for (Double n2: inputs) { + Double n = n1 * n2; + if (!xs.contains(n)) + xs.add(n); + } + } + Double[] arr = xs.toArray(new Double[0]); + Arrays.sort(arr); + return Arrays.asList(arr); + } + + public static void p(Object x) { + System.out.println(x); + } + public static void main(String[] args) { + for (TimeUnit t : TimeUnit.values()) { + for (Double n: makeNumbers()) { + String s = "" + n + " " + t.toString().toLowerCase(); + Duration d = Duration.create(n, t); + p(String.format("%25s => %s", s, d)); + } + } + for (String s: Arrays.asList("Inf", "-Inf", "+Inf", "PlusInf", "MinusInf")) { + Duration d = Duration.create(s); + p(String.format("%25s => %s", s, d)); + } + } +} |