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.1.0.31 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.1.0.30 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.1.0.29 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.1.0.28 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.1.0.27 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.1.0.26 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.1.0.25 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.1.0.24 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.1.0.23 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.1.0.22 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.1.0.21 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.1.0.20 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.1.0.19 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.1.0.18 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.1.0.17 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.1.0.16 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.1.0.15 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.1.0.14 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.1.0.13 tracks/groovy/exercises/grains/GrainsTest.groovy
trackler-2.1.0.12 tracks/groovy/exercises/grains/GrainsTest.groovy