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.6 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.0.8.5 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.0.8.4 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.0.8.3 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.0.8.2 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.0.8.1 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.0.7.0 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.0.6.44 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.0.6.43 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.0.6.42 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.0.6.41 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.0.6.40 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.0.6.39 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.0.6.38 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.0.6.37 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.0.6.36 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.0.6.35 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.0.6.34 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.0.6.33 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.0.6.32 tracks/groovy/exercises/grains/GrainsTest.groovy