Sha256: 33519bbda2415e99a4fb29a5945be709f44cada25dfbb8dd3b7e1b126b1c3dba

Contents?: true

Size: 747 Bytes

Versions: 76

Compression:

Stored size: 747 Bytes

Contents

import ceylon.test { ... }

{[String, Integer, Integer?]*} cases => {
  ["29", 2, 18],
  ["0123456789", 2, 72],
  ["576802143", 2, 48],
  ["0123456789", 3, 504],
  ["1027839564", 3, 270],
  ["0123456789", 5, 15120],
  ["73167176531330624919225119674426574742355349194934", 6, 23520],
  ["0000", 2, 0],
  ["99099", 3, 0],
  ["123", 4, null],
  ["", 0, 1],
  ["123", 0, 1],
  ["", 1, null],
  ["1234a5", 2, null],
  ["12345", -1, null]
};

test
parameters(`value cases`)
void testLargestProduct(String digits, Integer window, Integer? expected) {
  value result = largestProduct(digits, window);
  if (exists expected) {
    assertEquals(result, expected);
  } else if (!is Error result) {
    fail("should have errored, but got ``result``");
  }
}

Version data entries

76 entries across 76 versions & 1 rubygems

Version Path
trackler-2.0.8.43 tracks/ceylon/exercises/largest-series-product/source/largestseriesproduct/SeriesTest.ceylon
trackler-2.0.8.42 tracks/ceylon/exercises/largest-series-product/source/largestseriesproduct/SeriesTest.ceylon
trackler-2.0.8.41 tracks/ceylon/exercises/largest-series-product/source/largestseriesproduct/SeriesTest.ceylon
trackler-2.0.8.40 tracks/ceylon/exercises/largest-series-product/source/largestseriesproduct/SeriesTest.ceylon
trackler-2.0.8.39 tracks/ceylon/exercises/largest-series-product/source/largestseriesproduct/SeriesTest.ceylon
trackler-2.0.8.38 tracks/ceylon/exercises/largest-series-product/source/largestseriesproduct/SeriesTest.ceylon
trackler-2.0.8.37 tracks/ceylon/exercises/largest-series-product/source/largestseriesproduct/SeriesTest.ceylon
trackler-2.0.8.36 tracks/ceylon/exercises/largest-series-product/source/largestseriesproduct/SeriesTest.ceylon
trackler-2.0.8.35 tracks/ceylon/exercises/largest-series-product/source/largestseriesproduct/SeriesTest.ceylon
trackler-2.0.8.34 tracks/ceylon/exercises/largest-series-product/source/largestseriesproduct/SeriesTest.ceylon
trackler-2.0.8.33 tracks/ceylon/exercises/largest-series-product/source/largestseriesproduct/SeriesTest.ceylon
trackler-2.0.8.32 tracks/ceylon/exercises/largest-series-product/source/largestseriesproduct/SeriesTest.ceylon
trackler-2.0.8.31 tracks/ceylon/exercises/largest-series-product/source/largestseriesproduct/SeriesTest.ceylon
trackler-2.0.8.30 tracks/ceylon/exercises/largest-series-product/source/largestseriesproduct/SeriesTest.ceylon
trackler-2.0.8.29 tracks/ceylon/exercises/largest-series-product/source/largestseriesproduct/SeriesTest.ceylon
trackler-2.0.8.28 tracks/ceylon/exercises/largest-series-product/source/largestseriesproduct/SeriesTest.ceylon
trackler-2.0.8.27 tracks/ceylon/exercises/largest-series-product/source/largestseriesproduct/SeriesTest.ceylon
trackler-2.0.8.26 tracks/ceylon/exercises/largest-series-product/source/largestseriesproduct/SeriesTest.ceylon
trackler-2.0.8.24 tracks/ceylon/exercises/largest-series-product/source/largestseriesproduct/SeriesTest.ceylon
trackler-2.0.8.23 tracks/ceylon/exercises/largest-series-product/source/largestseriesproduct/SeriesTest.ceylon