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.2.1.9 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.2.1.8 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.2.1.7 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.2.1.6 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.2.1.5 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.2.1.4 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.2.1.3 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.2.1.2 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.2.1.1 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.2.1.0 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.2.0.6 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.2.0.5 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.2.0.4 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.2.0.3 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.2.0.2 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.2.0.1 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.2.0.0 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.1.0.55 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.1.0.54 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.1.0.53 tracks/groovy/exercises/grains/GrainsTest.groovy