trackler 2.2.1.65 → 2.2.1.66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/trackler/version.rb +1 -1
- data/problem-specifications/exercises/reverse-string/canonical-data.json +3 -3
- data/tracks/c/exercises/hello-world/makefile +9 -0
- data/tracks/c/exercises/phone-number/test/test_phone_number.c +2 -1
- data/tracks/go/exercises/collatz-conjecture/.meta/gen.go +72 -0
- data/tracks/go/exercises/collatz-conjecture/cases_test.go +43 -0
- data/tracks/go/exercises/collatz-conjecture/collatz_conjecture_test.go +0 -42
- data/tracks/perl6/config.json +10 -0
- data/tracks/perl6/docs/ABOUT.md +21 -12
- data/tracks/perl6/exercises/all-your-base/AllYourBase.pm6 +4 -1
- data/tracks/perl6/exercises/all-your-base/Example.pm6 +14 -34
- data/tracks/perl6/exercises/all-your-base/all-your-base.t +40 -53
- data/tracks/perl6/exercises/all-your-base/example.yaml +31 -51
- data/tracks/perl6/exercises/hamming/Example.pm6 +5 -4
- data/tracks/perl6/exercises/hamming/Hamming.pm6 +1 -1
- data/tracks/perl6/exercises/hamming/example.yaml +6 -5
- data/tracks/perl6/exercises/hamming/hamming.t +2 -2
- data/tracks/perl6/exercises/meetup/README.md +16 -12
- data/tracks/perl6/exercises/nucleotide-count/Example.pm6 +7 -0
- data/tracks/perl6/exercises/nucleotide-count/NucleotideCount.pm6 +4 -0
- data/tracks/perl6/exercises/nucleotide-count/README.md +38 -0
- data/tracks/perl6/exercises/nucleotide-count/example.yaml +24 -0
- data/tracks/perl6/exercises/nucleotide-count/nucleotide-count.t +116 -0
- data/tracks/python/exercises/perfect-numbers/example.py +13 -2
- data/tracks/python/exercises/perfect-numbers/perfect_numbers.py +1 -5
- data/tracks/python/exercises/perfect-numbers/perfect_numbers_test.py +60 -22
- data/tracks/python/test/check-exercises.py +1 -30
- data/tracks/scala/config.json +12 -0
- data/tracks/scala/exercises/flatten-array/README.md +29 -0
- data/tracks/scala/exercises/flatten-array/build.sbt +3 -0
- data/tracks/scala/exercises/flatten-array/example.scala +7 -0
- data/tracks/scala/exercises/flatten-array/project/build.properties +1 -0
- data/tracks/scala/exercises/flatten-array/src/main/scala/.keep +0 -0
- data/tracks/scala/exercises/flatten-array/src/test/scala/FlattenArrayTest.scala +55 -0
- metadata +15 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3204de800ec7eef566ccc5e2a48e9dd99d70a407
|
|
4
|
+
data.tar.gz: 8ea801d22c63ea5a884e0b879fcfa80af2f611cb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d62a8b637aaa23601fe7bf220d463a4ed3d01382bbc2648495ba884da180c05ff14926ff0009a937dc2c63e0f3570365bd1777e32ee655dade7cf3050366b670
|
|
7
|
+
data.tar.gz: f40ff5b7155f9837e9d8c5bd5a73e04ffc89e043295d56fc32be38c168db4342bca2696e62e6849a0c642344c22f2f16f5b36fd52c2a60771c032c06784a577d
|
data/lib/trackler/version.rb
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"exercise": "reverse-string",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"comments": [
|
|
5
5
|
"If property based testing tools are available, a good property to test is reversing a string twice: reverse(reverse(string)) == string"
|
|
6
6
|
],
|
|
7
7
|
"cases": [
|
|
8
8
|
{
|
|
9
|
-
"description": "empty string",
|
|
9
|
+
"description": "an empty string",
|
|
10
10
|
"property": "reverse",
|
|
11
11
|
"input": "",
|
|
12
12
|
"expected": ""
|
|
@@ -36,4 +36,4 @@
|
|
|
36
36
|
"expected": "racecar"
|
|
37
37
|
}
|
|
38
38
|
]
|
|
39
|
-
}
|
|
39
|
+
}
|
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
CFLAGS = -std=c99
|
|
2
|
+
CFLAGS += -g
|
|
2
3
|
CFLAGS += -Wall
|
|
3
4
|
CFLAGS += -Wextra
|
|
4
5
|
CFLAGS += -pedantic
|
|
5
6
|
CFLAGS += -Werror
|
|
6
7
|
|
|
8
|
+
VFLAGS = --quiet
|
|
9
|
+
VFLAGS += --tool=memcheck
|
|
10
|
+
VFLAGS += --leak-check=full
|
|
11
|
+
VFLAGS += --error-exitcode=1
|
|
7
12
|
|
|
8
13
|
test: tests.out
|
|
9
14
|
@./tests.out
|
|
10
15
|
|
|
16
|
+
memcheck: tests.out
|
|
17
|
+
@valgrind $(VFLAGS) ./tests.out
|
|
18
|
+
@echo "Memory check passed"
|
|
19
|
+
|
|
11
20
|
clean:
|
|
12
21
|
rm -f *.o *.out
|
|
13
22
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
#include "../src/phone_number.h"
|
|
3
3
|
#include <stdlib.h>
|
|
4
4
|
|
|
5
|
-
char *result;
|
|
5
|
+
static char *result = NULL;
|
|
6
6
|
|
|
7
7
|
void setUp(void)
|
|
8
8
|
{
|
|
@@ -11,6 +11,7 @@ void setUp(void)
|
|
|
11
11
|
void tearDown(void)
|
|
12
12
|
{
|
|
13
13
|
free(result);
|
|
14
|
+
result = NULL;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
void test_cleans_parens_dashes_and_spaces_from_the_number(void)
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
package main
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"log"
|
|
5
|
+
"text/template"
|
|
6
|
+
|
|
7
|
+
"../../../gen"
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
func main() {
|
|
11
|
+
t, err := template.New("").Parse(tmpl)
|
|
12
|
+
if err != nil {
|
|
13
|
+
log.Fatal(err)
|
|
14
|
+
}
|
|
15
|
+
var j js
|
|
16
|
+
if err := gen.Gen("collatz-conjecture", &j, t); err != nil {
|
|
17
|
+
log.Fatal(err)
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
type OneCase struct {
|
|
22
|
+
Description string
|
|
23
|
+
Number int
|
|
24
|
+
Expected interface{}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// The JSON structure we expect to be able to unmarshal into
|
|
28
|
+
type js struct {
|
|
29
|
+
Cases []OneCase
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
func (c OneCase) Valid() bool {
|
|
33
|
+
valid, _ := determineExpected(c.Expected)
|
|
34
|
+
return valid
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
func (c OneCase) Answer() int {
|
|
38
|
+
_, answer := determineExpected(c.Expected)
|
|
39
|
+
return answer
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// determineExpected examines an .Expected interface{} object and determines
|
|
43
|
+
// whether a test case is valid(bool) and has an answer or expects an error.
|
|
44
|
+
// returning valid and answer.
|
|
45
|
+
func determineExpected(expected interface{}) (bool, int) {
|
|
46
|
+
ans, ok := expected.(float64)
|
|
47
|
+
if ok {
|
|
48
|
+
return ok, int(ans)
|
|
49
|
+
}
|
|
50
|
+
return false, 0
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// template applied to above data structure generates the Go test cases
|
|
54
|
+
var tmpl = `package collatzconjecture
|
|
55
|
+
|
|
56
|
+
{{.Header}}
|
|
57
|
+
|
|
58
|
+
var testCases = []struct {
|
|
59
|
+
description string
|
|
60
|
+
input int
|
|
61
|
+
expectError bool
|
|
62
|
+
expected int
|
|
63
|
+
}{
|
|
64
|
+
{{range .J.Cases}}{
|
|
65
|
+
description: "{{.Description}}",
|
|
66
|
+
input: {{.Number}},
|
|
67
|
+
{{if .Valid}} expected: {{.Answer}},
|
|
68
|
+
{{- else}} expectError: true,
|
|
69
|
+
{{- end}}
|
|
70
|
+
},
|
|
71
|
+
{{end}}}
|
|
72
|
+
`
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
package collatzconjecture
|
|
2
|
+
|
|
3
|
+
// Source: exercism/problem-specifications
|
|
4
|
+
// Commit: 25c4479 Collatz-conjecture: remove trailing space in test name (#839)
|
|
5
|
+
// Problem Specifications Version: 1.1.1
|
|
6
|
+
|
|
7
|
+
var testCases = []struct {
|
|
8
|
+
description string
|
|
9
|
+
input int
|
|
10
|
+
expectError bool
|
|
11
|
+
expected int
|
|
12
|
+
}{
|
|
13
|
+
{
|
|
14
|
+
description: "zero steps for one",
|
|
15
|
+
input: 1,
|
|
16
|
+
expected: 0,
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
description: "divide if even",
|
|
20
|
+
input: 16,
|
|
21
|
+
expected: 4,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
description: "even and odd steps",
|
|
25
|
+
input: 12,
|
|
26
|
+
expected: 9,
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
description: "Large number of even and odd steps",
|
|
30
|
+
input: 1000000,
|
|
31
|
+
expected: 152,
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
description: "zero is an error",
|
|
35
|
+
input: 0,
|
|
36
|
+
expectError: true,
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
description: "negative value is an error",
|
|
40
|
+
input: -15,
|
|
41
|
+
expectError: true,
|
|
42
|
+
},
|
|
43
|
+
}
|
|
@@ -4,48 +4,6 @@ import (
|
|
|
4
4
|
"testing"
|
|
5
5
|
)
|
|
6
6
|
|
|
7
|
-
var testCases = []struct {
|
|
8
|
-
description string
|
|
9
|
-
input int
|
|
10
|
-
expectError bool
|
|
11
|
-
expected int
|
|
12
|
-
}{
|
|
13
|
-
{
|
|
14
|
-
description: "zero steps for one",
|
|
15
|
-
input: 1,
|
|
16
|
-
expectError: false,
|
|
17
|
-
expected: 0,
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
description: "divide if even",
|
|
21
|
-
input: 16,
|
|
22
|
-
expectError: false,
|
|
23
|
-
expected: 4,
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
description: "even and old steps",
|
|
27
|
-
input: 12,
|
|
28
|
-
expectError: false,
|
|
29
|
-
expected: 9,
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
description: "large number of even and odd steps",
|
|
33
|
-
input: 1000000,
|
|
34
|
-
expectError: false,
|
|
35
|
-
expected: 152,
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
description: "zero is an error",
|
|
39
|
-
input: 0,
|
|
40
|
-
expectError: true,
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
description: "negative value is an error",
|
|
44
|
-
input: -15,
|
|
45
|
-
expectError: true,
|
|
46
|
-
},
|
|
47
|
-
}
|
|
48
|
-
|
|
49
7
|
func TestCollatzConjecture(t *testing.T) {
|
|
50
8
|
for _, testCase := range testCases {
|
|
51
9
|
steps, err := CollatzConjecture(testCase.input)
|
data/tracks/perl6/config.json
CHANGED
|
@@ -98,6 +98,16 @@
|
|
|
98
98
|
|
|
99
99
|
]
|
|
100
100
|
},
|
|
101
|
+
{
|
|
102
|
+
"uuid": "0313a0a8-0d35-f480-7dce-65154edf4e804d52dc1",
|
|
103
|
+
"slug": "nucleotide-count",
|
|
104
|
+
"core": false,
|
|
105
|
+
"unlocked_by": null,
|
|
106
|
+
"difficulty": 3,
|
|
107
|
+
"topics": [
|
|
108
|
+
|
|
109
|
+
]
|
|
110
|
+
},
|
|
101
111
|
{
|
|
102
112
|
"uuid": "9fc9b102-185d-4f34-98d0-e3084399610a",
|
|
103
113
|
"slug": "clock",
|
data/tracks/perl6/docs/ABOUT.md
CHANGED
|
@@ -1,15 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
Perl 6 is a clean, modern, multi-paradigm language; it offers procedural,
|
|
2
|
+
object-oriented AND functional programming methodologies. It is a supremely
|
|
3
|
+
flexible language, adapting to your style of programming, whether that be quick
|
|
4
|
+
oneliners for sysadmins, scripts to manage a database import, or the full stack
|
|
5
|
+
of modules necessary to realise an entire website.
|
|
2
6
|
|
|
3
|
-
|
|
4
|
-
|
|
7
|
+
Perl 6 enhances Perl’s longterm appeal with a proper object system including
|
|
8
|
+
roles, threading and multimethod dispatch. It has spent a long time coming to
|
|
9
|
+
fruition and has learned from other programming languages, building on their
|
|
10
|
+
success and learning from the issues of the past. We believe Perl 6 is a
|
|
11
|
+
language that will last for decades as it has been conceived to adapt to future
|
|
12
|
+
trends and is flexible in its usage with other languages.
|
|
5
13
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
14
|
+
Perl 6 learns from other languages. For instance: taking threading from Java
|
|
15
|
+
(simplified to a handful of methods); Foreign-function interfaces from Lisp make
|
|
16
|
+
accessing libraries as simple as one line of code. Regular expressions are now
|
|
17
|
+
turned up to 11 with the introduction of Parser Expression Grammars, which let
|
|
18
|
+
you tackle huge parsing tasks. Strictures and warnings are now automatic,
|
|
19
|
+
cutting out huge swathes of potential errors.
|
|
9
20
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
* **Zef:** Is a Perl 6 module installer.
|
|
15
|
-
* **Rakudo Star:** Is a bundle that includes Rakudo, Zef, a collection of Perl 6 modules, and documentation.
|
|
21
|
+
Perl 6’s mottos remain the same as Perl: “Perl is different. In a nutshell,
|
|
22
|
+
Perl is designed to make the easy jobs easy, without making the hard jobs
|
|
23
|
+
impossible.” and “There Is More Than One Way To Do It”. Now with even more
|
|
24
|
+
-Ofun (optimized for fun) added.
|
|
@@ -1,46 +1,26 @@
|
|
|
1
|
-
unit module AllYourBase:ver<
|
|
1
|
+
unit module AllYourBase:ver<3>;
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
has %.payload;
|
|
10
|
-
method message {"%!payload<digit> is not a valid digit for base %!payload<base>."}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
sub convert-base (Int:D $input-base, @input-digits, Int:D $output-base --> Array:D) is export {
|
|
14
|
-
for $input-base, $output-base {
|
|
15
|
-
X::AllYourBase::InvalidBase.new(payload => $_).throw if $_ < 2;
|
|
16
|
-
}
|
|
17
|
-
from-decimal($output-base, (to-decimal $input-base, @input-digits));
|
|
3
|
+
sub convert-base (
|
|
4
|
+
:%bases! where all(.keys ~~ <from to>.Set, .values.all > 1),
|
|
5
|
+
:@digits! where %bases<from> > .all ~~ UInt:D,
|
|
6
|
+
--> Array[UInt:D]
|
|
7
|
+
) is export {
|
|
8
|
+
from-decimal %bases<to>, to-decimal(%bases<from>, @digits);
|
|
18
9
|
}
|
|
19
10
|
|
|
20
11
|
sub to-decimal ($input-base, @input-digits) {
|
|
21
|
-
return [].Slip if !@input-digits;
|
|
22
12
|
my $elems = @input-digits.elems;
|
|
23
|
-
for @input-digits
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
my $dec = 0;
|
|
28
|
-
loop (my $i = 0; $i < $elems; $i++) {
|
|
29
|
-
if @input-digits.reverse[$i] < 0 || @input-digits.reverse[$i] >= $input-base {
|
|
30
|
-
X::AllYourBase::InvalidDigit.new( :payload(base => $input-base, digit => @input-digits.reverse[$i]) ).throw;
|
|
31
|
-
}
|
|
32
|
-
$dec += @input-digits.reverse[$i] * $input-base ** $i;
|
|
33
|
-
}
|
|
34
|
-
return $dec;
|
|
13
|
+
$_ == 0 ?? $elems-- !! last for @input-digits;
|
|
14
|
+
(loop (my $i = 0; $i < $elems; $i++) {
|
|
15
|
+
@input-digits.reverse[$i] * $input-base ** $i;
|
|
16
|
+
}).sum;
|
|
35
17
|
}
|
|
36
18
|
|
|
37
|
-
sub from-decimal ($output-base, $
|
|
38
|
-
my @output-digits;
|
|
39
|
-
my $num = $dec;
|
|
19
|
+
sub from-decimal ($output-base, $num is copy) {
|
|
20
|
+
my UInt:D @output-digits;
|
|
40
21
|
while $num >= $output-base {
|
|
41
22
|
unshift @output-digits, $num % $output-base;
|
|
42
23
|
$num div= $output-base;
|
|
43
24
|
}
|
|
44
|
-
|
|
45
|
-
return @output-digits;
|
|
25
|
+
@output-digits.unshift: $num;
|
|
46
26
|
}
|
|
@@ -5,7 +5,7 @@ use lib my $dir = $?FILE.IO.dirname;
|
|
|
5
5
|
use JSON::Fast;
|
|
6
6
|
|
|
7
7
|
my Str:D $exercise := 'AllYourBase';
|
|
8
|
-
my Version:D $version =
|
|
8
|
+
my Version:D $version = v3;
|
|
9
9
|
my Str $module //= $exercise;
|
|
10
10
|
plan 23;
|
|
11
11
|
|
|
@@ -22,26 +22,22 @@ if ::($exercise).^ver !~~ $version {
|
|
|
22
22
|
require ::($module) <&convert-base>;
|
|
23
23
|
|
|
24
24
|
my $c-data = from-json $=pod.pop.contents;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
when /base|digit/ { throws-like {call-convert-base}, Exception, $_ }
|
|
32
|
-
when /zero/ {
|
|
33
|
-
when 'leading zeros' { test [4,2] }
|
|
34
|
-
default { test [0] }
|
|
35
|
-
}
|
|
36
|
-
flunk "$_; not tested" if %*ENV<EXERCISM>; # To ensure that no canonical-data cases are missed.
|
|
37
|
-
}
|
|
25
|
+
for $c-data<cases>.values -> $case {
|
|
26
|
+
sub call-convert-base {
|
|
27
|
+
convert-base(
|
|
28
|
+
bases => %(<from to> Z=> .<input_base output_base>),
|
|
29
|
+
digits => .<input_digits>,
|
|
30
|
+
) given $case;
|
|
38
31
|
}
|
|
39
32
|
|
|
40
|
-
|
|
41
|
-
|
|
33
|
+
given $case {
|
|
34
|
+
if .<expected><error> {
|
|
35
|
+
throws-like {call-convert-base}, Exception, .<description>;
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
cmp-ok call-convert-base, ‘~~’, |.<expected description>;
|
|
39
|
+
}
|
|
42
40
|
}
|
|
43
|
-
|
|
44
|
-
sub call-convert-base { convert-base(|$case<input_base input_digits output_base>) }
|
|
45
41
|
}
|
|
46
42
|
|
|
47
43
|
=head2 Canonical Data
|
|
@@ -49,24 +45,15 @@ for @($c-data<cases>) -> $case {
|
|
|
49
45
|
|
|
50
46
|
{
|
|
51
47
|
"exercise": "all-your-base",
|
|
52
|
-
"version": "
|
|
48
|
+
"version": "2.0.1",
|
|
53
49
|
"comments": [
|
|
54
|
-
"
|
|
50
|
+
"This canonical data makes the following choices:",
|
|
51
|
+
"1. Zero is always represented in outputs as [0] instead of [].",
|
|
52
|
+
"2. In no other instances are leading zeroes present in any outputs.",
|
|
53
|
+
"3. Leading zeroes are accepted in inputs.",
|
|
54
|
+
"4. An empty sequence of input digits is considered zero, rather than an error.",
|
|
55
55
|
"",
|
|
56
|
-
"
|
|
57
|
-
" - []?",
|
|
58
|
-
" - [0]?",
|
|
59
|
-
"",
|
|
60
|
-
"2. What representations of zero are allowed?",
|
|
61
|
-
" - []?",
|
|
62
|
-
" - [0]?",
|
|
63
|
-
" - [0,0]?",
|
|
64
|
-
"",
|
|
65
|
-
"3. Are leading zeroes allowed?",
|
|
66
|
-
"",
|
|
67
|
-
"4. How should invalid input be handled?",
|
|
68
|
-
"",
|
|
69
|
-
"All the undefined cases are marked as null.",
|
|
56
|
+
"Tracks that wish to make different decisions for these choices may translate appropriately.",
|
|
70
57
|
"",
|
|
71
58
|
"All your numeric-base are belong to [2..]. :)"
|
|
72
59
|
],
|
|
@@ -141,7 +128,7 @@ for @($c-data<cases>) -> $case {
|
|
|
141
128
|
"input_base": 2,
|
|
142
129
|
"input_digits": [],
|
|
143
130
|
"output_base": 10,
|
|
144
|
-
"expected":
|
|
131
|
+
"expected": [0]
|
|
145
132
|
},
|
|
146
133
|
{
|
|
147
134
|
"description": "single zero",
|
|
@@ -149,7 +136,7 @@ for @($c-data<cases>) -> $case {
|
|
|
149
136
|
"input_base": 10,
|
|
150
137
|
"input_digits": [0],
|
|
151
138
|
"output_base": 2,
|
|
152
|
-
"expected":
|
|
139
|
+
"expected": [0]
|
|
153
140
|
},
|
|
154
141
|
{
|
|
155
142
|
"description": "multiple zeros",
|
|
@@ -157,7 +144,7 @@ for @($c-data<cases>) -> $case {
|
|
|
157
144
|
"input_base": 10,
|
|
158
145
|
"input_digits": [0, 0, 0],
|
|
159
146
|
"output_base": 2,
|
|
160
|
-
"expected":
|
|
147
|
+
"expected": [0]
|
|
161
148
|
},
|
|
162
149
|
{
|
|
163
150
|
"description": "leading zeros",
|
|
@@ -165,31 +152,31 @@ for @($c-data<cases>) -> $case {
|
|
|
165
152
|
"input_base": 7,
|
|
166
153
|
"input_digits": [0, 6, 0],
|
|
167
154
|
"output_base": 10,
|
|
168
|
-
"expected":
|
|
155
|
+
"expected": [4, 2]
|
|
169
156
|
},
|
|
170
157
|
{
|
|
171
|
-
"description": "
|
|
158
|
+
"description": "input base is one",
|
|
172
159
|
"property": "rebase",
|
|
173
160
|
"input_base": 1,
|
|
174
161
|
"input_digits": [],
|
|
175
162
|
"output_base": 10,
|
|
176
|
-
"expected":
|
|
163
|
+
"expected": {"error": "input base must be >= 2"}
|
|
177
164
|
},
|
|
178
165
|
{
|
|
179
|
-
"description": "
|
|
166
|
+
"description": "input base is zero",
|
|
180
167
|
"property": "rebase",
|
|
181
168
|
"input_base": 0,
|
|
182
169
|
"input_digits": [],
|
|
183
170
|
"output_base": 10,
|
|
184
|
-
"expected":
|
|
171
|
+
"expected": {"error": "input base must be >= 2"}
|
|
185
172
|
},
|
|
186
173
|
{
|
|
187
|
-
"description": "
|
|
174
|
+
"description": "input base is negative",
|
|
188
175
|
"property": "rebase",
|
|
189
176
|
"input_base": -2,
|
|
190
177
|
"input_digits": [1],
|
|
191
178
|
"output_base": 10,
|
|
192
|
-
"expected":
|
|
179
|
+
"expected": {"error": "input base must be >= 2"}
|
|
193
180
|
},
|
|
194
181
|
{
|
|
195
182
|
"description": "negative digit",
|
|
@@ -197,7 +184,7 @@ for @($c-data<cases>) -> $case {
|
|
|
197
184
|
"input_base": 2,
|
|
198
185
|
"input_digits": [1, -1, 1, 0, 1, 0],
|
|
199
186
|
"output_base": 10,
|
|
200
|
-
"expected":
|
|
187
|
+
"expected": {"error": "all digits must satisfy 0 <= d < input base"}
|
|
201
188
|
},
|
|
202
189
|
{
|
|
203
190
|
"description": "invalid positive digit",
|
|
@@ -205,31 +192,31 @@ for @($c-data<cases>) -> $case {
|
|
|
205
192
|
"input_base": 2,
|
|
206
193
|
"input_digits": [1, 2, 1, 0, 1, 0],
|
|
207
194
|
"output_base": 10,
|
|
208
|
-
"expected":
|
|
195
|
+
"expected": {"error": "all digits must satisfy 0 <= d < input base"}
|
|
209
196
|
},
|
|
210
197
|
{
|
|
211
|
-
"description": "
|
|
198
|
+
"description": "output base is one",
|
|
212
199
|
"property": "rebase",
|
|
213
200
|
"input_base": 2,
|
|
214
201
|
"input_digits": [1, 0, 1, 0, 1, 0],
|
|
215
202
|
"output_base": 1,
|
|
216
|
-
"expected":
|
|
203
|
+
"expected": {"error": "output base must be >= 2"}
|
|
217
204
|
},
|
|
218
205
|
{
|
|
219
|
-
"description": "
|
|
206
|
+
"description": "output base is zero",
|
|
220
207
|
"property": "rebase",
|
|
221
208
|
"input_base": 10,
|
|
222
209
|
"input_digits": [7],
|
|
223
210
|
"output_base": 0,
|
|
224
|
-
"expected":
|
|
211
|
+
"expected": {"error": "output base must be >= 2"}
|
|
225
212
|
},
|
|
226
213
|
{
|
|
227
|
-
"description": "
|
|
214
|
+
"description": "output base is negative",
|
|
228
215
|
"property": "rebase",
|
|
229
216
|
"input_base": 2,
|
|
230
217
|
"input_digits": [1],
|
|
231
218
|
"output_base": -7,
|
|
232
|
-
"expected":
|
|
219
|
+
"expected": {"error": "output base must be >= 2"}
|
|
233
220
|
},
|
|
234
221
|
{
|
|
235
222
|
"description": "both bases are negative",
|
|
@@ -237,7 +224,7 @@ for @($c-data<cases>) -> $case {
|
|
|
237
224
|
"input_base": -2,
|
|
238
225
|
"input_digits": [1],
|
|
239
226
|
"output_base": -7,
|
|
240
|
-
"expected":
|
|
227
|
+
"expected": {"error": "input base must be >= 2"}
|
|
241
228
|
}
|
|
242
229
|
]
|
|
243
230
|
}
|