Sha256: 6495aa76a26803b23c4021def81b998b2d3642fa451a83a1830d70954f0e86f8

Contents?: true

Size: 799 Bytes

Versions: 227

Compression:

Stored size: 799 Bytes

Contents

import org.junit.Test
import static org.junit.Assert.assertEquals

class GrainsTest {
  @Test
  void testSquare1() {
    assertEquals 1, new Grains().square(1)
  }

  @Test
  void testSquare2() {
    assertEquals 2, new Grains().square(2)
  }

  @Test
  void testSquare3() {
    assertEquals 4, new Grains().square(3)
  }

  @Test
  void testSquare4() {
    assertEquals 8, new Grains().square(4)
  }

  @Test
  void testSquare16() {
    assertEquals 32768, new Grains().square(16)
  }

  @Test
  void testSquare32() {
    // GROOVY-7129
    assertEquals 2147483648, new Grains().square(32).toLong()
  }

  @Test
  void testSquare64() {
    assertEquals 9223372036854775808, new Grains().square(64)
  }

  @Test
  void testTotal() {
    assertEquals 18446744073709551615, new Grains().total()
  }
}

Version data entries

227 entries across 227 versions & 1 rubygems

Version Path
trackler-2.0.8.47 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.0.8.46 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.0.8.45 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.0.8.44 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.0.8.43 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.0.8.42 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.0.8.41 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.0.8.40 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.0.8.39 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.0.8.38 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.0.8.37 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.0.8.36 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.0.8.35 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.0.8.34 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.0.8.33 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.0.8.32 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.0.8.31 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.0.8.30 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.0.8.29 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.0.8.28 tracks/groovy/exercises/grains/GrainsTest.groovy