~ubuntu-branches/debian/sid/scala/sid

« back to all changes in this revision

Viewing changes to test/files/jvm/bigints.scala

  • Committer: Package Import Robot
  • Author(s): Emmanuel Bourg, Mehdi Dogguy, Lucas Satabin, Frank S. Thomas, Emmanuel Bourg
  • Date: 2015-06-05 23:52:59 UTC
  • mfrom: (1.2.11)
  • Revision ID: package-import@ubuntu.com-20150605235259-wk00vgk83dh8o19g
Tags: 2.10.5-1
* Team upload.

[ Mehdi Dogguy ]
* New upstream release (Closes: #744278).

[ Lucas Satabin ]
* Update patches
* Update the clean target
* Update paths of elements to install
* Update watch file

[ Frank S. Thomas ]
* Remove myself from Uploaders.

[ Emmanuel Bourg ]
* The package has been adopted by the Java Team (Closes: #754935)
* Patched the build to avoid downloading libraries from the Internet
* Replaced the minified JavaScript files with unobfuscated ones
* No longer build scala-partest.jar until diffutils is packaged or replaced
* debian/watch: Fixed the versions matched (x.y.z instead of x.y.z..z)
* debian/rules:
  - Added the missing get-orig-source target (Closes: #724704)
  - Improved the clean target
* debian/control:
  - Build depend on scala (>= 2.10) and bnd
  - Use canonical URLs for the Vcs-* fields
  - Standards-Version updated to 3.9.6 (no changes)
* Switch to debhelper level 9

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
//############################################################################
2
 
// BigInt, BigDecimal 
3
 
//############################################################################
4
 
 
5
 
//############################################################################
6
 
 
7
 
import testing.SUnit._
8
 
 
9
 
/** Test the Scala implementation of class <code>scala.BigDecimal</code>.
 
1
/** Test the Scala implementation of classes <code>scala.BigInt</code>
 
2
* and <code>scala.BigDecimal</code>.
10
3
*
11
4
*  @author Stephane Micheloud
12
5
*/
13
 
object Test extends TestConsoleMain {
14
 
  def suite = new TestSuite(
15
 
    Test_BigInt,
16
 
    Test_BigDecimal
17
 
  )
 
6
object Test {
 
7
  def main(args: Array[String]) {
 
8
    Test_BigInt.runTest()
 
9
    Test_BigDecimal.runTest()
 
10
  }
18
11
}
19
12
 
20
 
object Test_BigInt extends TestCase("BigInt") with Assert {
21
 
  override def enableStackTrace = false
22
 
  override def runTest {
 
13
object Test_BigInt {
 
14
  def runTest() {
23
15
    import BigInt._
24
16
 
25
17
    val x: BigInt = 1
26
18
    val y = x + 1
27
19
    val z = 1 + y
28
 
    assertEquals("int_add_bigint", 1+y, y+1)
29
 
    assertEquals("int_sub_bigint", 1-y, -(y-1))
30
 
    assertEquals("int_mul_bigint", 2*x*y, y*x*2)
31
 
    assertTrue("z_<=_3", z <= 3)
32
 
    assertFalse("3_<_z", 3 < z)
 
20
    println("int_add_bigint = " + (1+y, y+1))
 
21
    println("int_sub_bigint = " + (1-y,-(y-1)))
 
22
    println("int_mul_bigint = " + (2*x*y, y*x*2))
 
23
    println("z <= 3 = " + (z <= 3))
 
24
    println("3 < z = " + (3 < z))
33
25
  }
34
26
}
35
27
 
36
 
object Test_BigDecimal extends TestCase("BigDecimal") with Assert {
37
 
  override def enableStackTrace = false
38
 
  override def runTest {
 
28
object Test_BigDecimal {
 
29
  def runTest() {
39
30
    import scala.BigDecimal, BigDecimal._
40
31
 
41
32
    val xi: BigDecimal = 1
47
38
    val x: BigDecimal = 1
48
39
    val y = x + 1
49
40
    val z = 1 + y
50
 
    assertTrue("z_<=_3", z <= 3)
51
 
    assertFalse("3_<_z", 3 < z)
 
41
    println("z <= 3 = " + (z <= 3))
 
42
    println("3 < z = " + (3 < z))
52
43
 
53
 
    val a: BigDecimal= Math.MAX_LONG
 
44
    val a: BigDecimal= Long.MaxValue
54
45
    val b: BigDecimal = 1
55
46
    val c = a - b
56
 
    assertFalse("c_>_MAX_LONG", c > Math.MAX_LONG)
57
 
    assertTrue("c_<=_MAX_LONG", c <= Math.MAX_LONG)
 
47
    println("c > MAX_LONG = " + (c > Long.MaxValue))
 
48
    println("c <= MAX_LONG = " + (c <= Long.MaxValue))
58
49
  }
59
50
}
60
51