trackler 2.0.8.1 → 2.0.8.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/tracks/fsharp/exercises/list-ops/Example.fs +5 -5
  4. data/tracks/fsharp/exercises/list-ops/ListOpsTest.fs +2 -2
  5. data/tracks/go/exercises/TRACK_HINTS.md +6 -2
  6. data/tracks/go/exercises/series/asktoomuch_test.go +4 -4
  7. data/tracks/go/exercises/series/example.go +2 -0
  8. data/tracks/go/exercises/series/first_test.go +3 -3
  9. data/tracks/go/exercises/series/series_test.go +10 -2
  10. data/tracks/java/exercises/pangram/src/test/java/PangramsTest.java +6 -0
  11. data/tracks/javascript/exercises/robot-simulator/example.js +8 -1
  12. data/tracks/javascript/exercises/robot-simulator/robot-simulator.spec.js +4 -4
  13. data/tracks/julia/docs/ABOUT.md +12 -0
  14. data/tracks/julia/docs/INSTALLATION.md +2 -0
  15. data/tracks/julia/docs/RESOURCES.md +6 -0
  16. data/tracks/ocaml/exercises/hello-world/example.ml +1 -4
  17. data/tracks/ocaml/exercises/hello-world/hello_world.ml +1 -2
  18. data/tracks/ocaml/exercises/hello-world/hello_world.mli +2 -10
  19. data/tracks/ocaml/exercises/hello-world/test.ml +1 -3
  20. data/tracks/ocaml/exercises/luhn/test.ml +14 -14
  21. data/tracks/ocaml/tools/test-generator/src/parser.ml +2 -1
  22. data/tracks/ocaml/tools/test-generator/templates/hello-world/template.ml +1 -1
  23. data/tracks/python/.travis.yml +1 -0
  24. data/tracks/python/config.json +25 -0
  25. data/tracks/python/exercises/all-your-base/all_your_base_test.py +82 -0
  26. data/tracks/python/exercises/all-your-base/example.py +23 -0
  27. data/tracks/python/exercises/grep/example.py +57 -0
  28. data/tracks/python/exercises/grep/grep_test.py +225 -0
  29. data/tracks/python/exercises/linked-list/example.py +14 -0
  30. data/tracks/python/exercises/linked-list/linked_list.py +2 -1
  31. data/tracks/python/exercises/linked-list/linked_list_test.py +18 -0
  32. data/tracks/python/exercises/word-search/example.py +57 -0
  33. data/tracks/python/exercises/word-search/word_search.py +27 -0
  34. data/tracks/python/exercises/word-search/word_search_test.py +84 -0
  35. data/tracks/python/requirements-travis.txt +1 -1
  36. data/tracks/python/test/check-exercises.py +44 -19
  37. data/tracks/scala/config.json +9 -0
  38. data/tracks/scala/exercises/perfect-numbers/build.sbt +3 -0
  39. data/tracks/scala/exercises/perfect-numbers/example.scala +24 -0
  40. data/tracks/scala/exercises/perfect-numbers/src/main/scala/PerfectNumbers.scala +0 -0
  41. data/tracks/scala/exercises/perfect-numbers/src/test/scala/PerfectNumbersTest.scala +62 -0
  42. data/tracks/typescript/Makefile +8 -0
  43. metadata +13 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 31fb33c6f6d2b730536826f3f4636068f82e8fa6
4
- data.tar.gz: a508d69520c86df66d8d401c138c8416309dee96
3
+ metadata.gz: 628be9992a422198cd22ca843fb2037ba6c03d72
4
+ data.tar.gz: 2ee76fac59c86929d2224dcaa3b4ca3843dc7f4b
5
5
  SHA512:
6
- metadata.gz: c054cb72f146dad2bbc5d2f1db8b7dd1c5e2d335fc1354036ed49b7f3d59e5ea1a5675e7ed2f543ccd0543acd14edffaf7048ca9a333a55bdf528a8e2d2abb07
7
- data.tar.gz: 91f5aac573c1b8180254ecf5000ad9d3e297f9731b478149dbd1df2c157ab3119f78b424f5590706a00cc81ee275369c62b2c4489fd847ff5eba5a1efbc48a79
6
+ metadata.gz: 950598d86876b07601a68378108358eeeceb09dac2a380d8d5cc607eaa8b6282d0ef2dcd660900dcede06a36b1e5d3fed69ae5ed8c522715b3320c68df20b75b
7
+ data.tar.gz: 1c2ba152ea54815a1be22d9224f210cfc0b6d0dd402020481666c914569f02b69a36417f7307dddd5ca342fd6ad6df6ea45bce30e9e4b87fb2ba4a4604caee2f
@@ -1,3 +1,3 @@
1
1
  module Trackler
2
- VERSION = "2.0.8.1"
2
+ VERSION = "2.0.8.2"
3
3
  end
@@ -5,7 +5,7 @@ let rec foldl folder state list =
5
5
  | [] -> state
6
6
  | x::xs -> foldl folder (folder state x) xs
7
7
 
8
- let rec foldr folder state list =
8
+ let rec foldr folder list state =
9
9
  list
10
10
  |> List.rev
11
11
  |> foldl (fun acc item -> folder item acc) state
@@ -14,10 +14,10 @@ let length list = foldl (fun acc _ -> acc + 1) 0 list
14
14
 
15
15
  let reverse list = foldl (fun acc item -> item :: acc) [] list
16
16
 
17
- let map f list = foldr (fun item acc -> f item :: acc) [] list
17
+ let map f list = foldr (fun item acc -> f item :: acc) list []
18
18
 
19
- let filter f list = foldr (fun item acc -> if f item then item :: acc else acc) [] list
19
+ let filter f list = foldr (fun item acc -> if f item then item :: acc else acc) list []
20
20
 
21
- let append xs ys = foldr (fun item acc -> item :: acc) ys xs
21
+ let append xs ys = foldr (fun item acc -> item :: acc) xs ys
22
22
 
23
- let concat xs = foldr append [] xs
23
+ let concat xs = foldr append xs []
@@ -80,12 +80,12 @@ let ``foldl is not just foldr . flip`` () =
80
80
  [<Test>]
81
81
  [<Ignore("Remove to run test")>]
82
82
  let ``foldr as id`` () =
83
- Assert.That(foldr (fun item acc -> item :: acc) [] [1 .. big] = bigList, Is.True)
83
+ Assert.That(foldr (fun item acc -> item :: acc) [1 .. big] [] = bigList, Is.True)
84
84
 
85
85
  [<Test>]
86
86
  [<Ignore("Remove to run test")>]
87
87
  let ``foldr as append`` () =
88
- Assert.That(foldr (fun item acc -> item :: acc) [100 .. big] [1 .. 99] = bigList, Is.True)
88
+ Assert.That(foldr (fun item acc -> item :: acc) [1 .. 99] [100 .. big] = bigList, Is.True)
89
89
 
90
90
  [<Test>]
91
91
  [<Ignore("Remove to run test")>]
@@ -1,3 +1,5 @@
1
+ ## Running the tests
2
+
1
3
  To run the tests run the command `go test` from within the exercise directory.
2
4
 
3
5
  If the test suite contains benchmarks, you can run these with the `-bench`
@@ -5,5 +7,7 @@ flag:
5
7
 
6
8
  go test -bench .
7
9
 
8
- For more detailed info about the Go track see the [help
9
- page](http://exercism.io/languages/go).
10
+ ## Further information
11
+
12
+ For more detailed information about the Go track, including how to get help if
13
+ you're having trouble, please visit the exercism.io [Go language page](http://exercism.io/languages/go/about).
@@ -8,21 +8,21 @@ func TestAskTooMuch(t *testing.T) {
8
8
  test := allTests[0]
9
9
  defer func() {
10
10
  if recover() != nil {
11
- t.Fatalf("Yikes, UnsafeFirst(%d, %s) panicked!", test.n, test.s)
11
+ t.Fatalf("Yikes, UnsafeFirst(%d, %q) panicked!", test.n, test.s)
12
12
  }
13
13
  }()
14
14
  for _, test = range allTests {
15
15
  switch res := UnsafeFirst(test.n, test.s); {
16
16
  case len(test.out) > 0: // well, this should work
17
17
  if res != test.out[0] {
18
- t.Fatalf("Yikes, UnsafeFirst(%d, %s) = %q, want %q.",
18
+ t.Fatalf("Yikes, UnsafeFirst(%d, %q) = %q, want %q.",
19
19
  test.n, test.s, res, test.out[0])
20
20
  }
21
21
  case len(res) != test.n:
22
- t.Fatalf("Yikes, UnsafeFirst(%d, %s) = %q, but %q doesn't have %d characters.",
22
+ t.Fatalf("Yikes, UnsafeFirst(%d, %q) = %q, but %q doesn't have %d characters.",
23
23
  test.n, test.s, res, res, test.n)
24
24
  default:
25
- t.Fatalf("Yikes, UnsafeFirst(%d, %s) = %q, but %q isn't in %q",
25
+ t.Fatalf("Yikes, UnsafeFirst(%d, %q) = %q, but %q isn't in %q",
26
26
  test.n, test.s, res, res, test.s)
27
27
  }
28
28
  }
@@ -1,5 +1,7 @@
1
1
  package slice
2
2
 
3
+ const testVersion = 1
4
+
3
5
  func All(n int, s string) (r []string) {
4
6
  for i := 0; n <= len(s); i++ {
5
7
  r = append(r, s[i:n])
@@ -9,14 +9,14 @@ func TestFirst(t *testing.T) {
9
9
  switch res, ok := First(test.n, test.s); {
10
10
  case !ok:
11
11
  if len(test.out) > 0 {
12
- t.Fatalf("First(%d, %s) returned !ok, want ok.",
12
+ t.Fatalf("First(%d, %q) returned !ok, want ok.",
13
13
  test.n, test.s)
14
14
  }
15
15
  case len(test.out) == 0:
16
- t.Fatalf("First(%d, %s) = %s, %t. Expected ok == false",
16
+ t.Fatalf("First(%d, %q) = %q, %t. Expected ok == false",
17
17
  test.n, test.s, res, ok)
18
18
  case res != test.out[0]:
19
- t.Fatalf("First(%d, %s) = %s. Want %s.",
19
+ t.Fatalf("First(%d, %q) = %q. Want %q.",
20
20
  test.n, test.s, res, test.out[0])
21
21
  }
22
22
  }
@@ -34,6 +34,8 @@ import (
34
34
  "testing"
35
35
  )
36
36
 
37
+ const targetTestVersion = 1
38
+
37
39
  var allTests = []struct {
38
40
  n int
39
41
  s string
@@ -69,13 +71,19 @@ var allTests = []struct {
69
71
 
70
72
  var cx = "01032987583"
71
73
 
74
+ func TestTestVersion(t *testing.T) {
75
+ if testVersion != targetTestVersion {
76
+ t.Fatalf("Found testVersion = %v, want %v.", testVersion, targetTestVersion)
77
+ }
78
+ }
79
+
72
80
  func TestAll(t *testing.T) {
73
81
  for _, test := range allTests {
74
82
  switch res := All(test.n, test.s); {
75
83
  case len(res) == 0 && len(test.out) == 0:
76
84
  case reflect.DeepEqual(res, test.out):
77
85
  default:
78
- t.Fatalf("All(%d, %s) = %v, want %v.",
86
+ t.Fatalf("All(%d, %q) = %q, want %q.",
79
87
  test.n, test.s, res, test.out)
80
88
  }
81
89
  }
@@ -87,7 +95,7 @@ func TestUnsafeFirst(t *testing.T) {
87
95
  continue
88
96
  }
89
97
  if res := UnsafeFirst(test.n, test.s); res != test.out[0] {
90
- t.Fatalf("UnsafeFirst(%d, %s) = %s, want %s.",
98
+ t.Fatalf("UnsafeFirst(%d, %q) = %q, want %q.",
91
99
  test.n, test.s, res, test.out[0])
92
100
  }
93
101
  }
@@ -66,4 +66,10 @@ public class PangramsTest {
66
66
  public void panagramInAlphabetOtherThanAscii() {
67
67
  assertFalse(Pangrams.isPangram("Широкая электрификация южных губерний даст мощный толчок подъёму сельского хозяйства."));
68
68
  }
69
+
70
+ @Ignore
71
+ @Test
72
+ public void upperAndLowerCaseVersionsOfTheSameCharacterShouldNotBeCountedSeparately() {
73
+ assertFalse(Pangrams.isPangram("the quick brown fox jumped over the lazy FOX"));
74
+ }
69
75
  }
@@ -10,6 +10,13 @@ Robot.prototype.at = function (xcoord, ycoord) {
10
10
  };
11
11
 
12
12
  Robot.prototype.orient = function (direction) {
13
+ if (direction != 'north' &&
14
+ direction != 'south' &&
15
+ direction != 'east' &&
16
+ direction != 'west') {
17
+ throw 'Invalid Robot Bearing'
18
+ }
19
+
13
20
  this.bearing = direction;
14
21
  return 'The robot is pointed ' + direction;
15
22
  };
@@ -78,4 +85,4 @@ Robot.prototype.evaluate = function (s) {
78
85
  }, this);
79
86
  };
80
87
 
81
- module.exports = Robot;
88
+ module.exports = Robot;
@@ -14,11 +14,11 @@ describe('Robot', function() {
14
14
  });
15
15
 
16
16
  xit('invalid robot bearing', function() {
17
- try {
17
+ var incorrectlyOrientRobot = function () {
18
18
  robot.orient('crood');
19
- } catch(exception) {
20
- expect(exception).toEqual('Invalid Robot Bearing');
21
- }
19
+ };
20
+
21
+ expect(incorrectlyOrientRobot).toThrow(new Error('Invalid Robot Bearing'));
22
22
  });
23
23
 
24
24
  xit('turn right from north', function() {
@@ -0,0 +1,12 @@
1
+ Julia is an open-source high-level, high-performance dynamic programming language designed for technical and scientific computing while also being effective for general-purpose tasks. It is convenient to use for daily work but also runs fast enough to be deployed for high-performance applications.
2
+
3
+ Interesting features include:
4
+ - Large parts of [Julia's base library](https://github.com/julialang/julia) are written in Julia itself. Understanding and contributing to the Julia core does not require knowledge of another language.
5
+ - Easy to use interfaces to call libraries written in other languages, such as [C, Fortran](http://docs.julialang.org/en/stable/manual/calling-c-and-fortran-code/) and [Python](https://github.com/JuliaPy/PyCall.jl), directly.
6
+ - [Multiple dispatch](http://docs.julialang.org/en/stable/manual/methods/#man-methods)
7
+ - A dynamic, nominative and parametric [type system](http://docs.julialang.org/en/stable/manual/types/).
8
+ - Homoiconicity: Julia code can be represented in Julia itself, making it a good language to learn about [metaprogramming](http://docs.julialang.org/en/stable/manual/metaprogramming/).
9
+
10
+ The first public release was in 2012. You can find out more about the motivation behind it in the blog post ["Why We Created Julia"](http://julialang.org/blog/2012/02/why-we-created-julia) by the core developers.
11
+
12
+ Despite its young age, Julia is already being used in the real world in a variety of fields, such as but not limited to Finance, Data Science and Scientific Computing. You can find many showcase applications on [juliabloggers.com](http://www.juliabloggers.com/) and a list of publications about the language and its technical computing applications [here](http://julialang.org/publications/).
@@ -1,5 +1,7 @@
1
1
  To install Julia on your system follow the instructions on the [Julia Language Downloads page](http://julialang.org/downloads/).
2
2
 
3
+ [JuliaPro](http://juliacomputing.com/products/juliapro.html) includes the latest stable version of Julia, the Juno IDE, a debugger, a Jupyter notebook environment and many of the most popular Julia packages. It is a convenient way to install everything you will need to get started.
4
+
3
5
  For a local installation, it is recommended to use [Juno](http://junolab.org/). It's an IDE based on Atom and offers a powerful text editor as well as additional features for developing in Julia. Just follow the instructions on their website.
4
6
 
5
7
  A simple way to get started with Julia without the need of a local installation is [JuliaBox](http://junolab.org/), which is an online IDE based on Jupyter notebooks. You just access it from your browser, login and you can start solving exercises.
@@ -0,0 +1,6 @@
1
+ - [Julia Style Guide](docs.julialang.org/en/stable/manual/style-guide/): Guide on how to write idiomatic Julia code.
2
+ - [Performance Tips](http://docs.julialang.org/en/stable/manual/performance-tips/): Techniques to speed up your programs.
3
+ - [Julia Manual](http://docs.julialang.org/en/stable/manual/introduction/): Additional explanations and examples.
4
+ - [juliabloggers.com](http://www.juliabloggers.com/): Aggregator of Julia blog posts.
5
+ - [Julia Discourse](https://discourse.julialang.org/): Discussions about the language.
6
+ - [Julia YouTube channel](https://www.youtube.com/user/JuliaLanguage): Archive of JuliaCon talks.
@@ -1,4 +1 @@
1
- let greet subject =
2
- match subject with
3
- | None -> "Hello, World!"
4
- | Some(s) -> "Hello, " ^ s ^ "!"
1
+ let hello = "Hello, World!"
@@ -1,2 +1 @@
1
- let greet subject =
2
- "your code here"
1
+ let hello = "Change me"
@@ -1,12 +1,4 @@
1
1
  (*
2
- Return a greeting to an optional subject
3
-
4
- ## Examples
5
-
6
- ### greet None
7
- "Hello, World!"
8
-
9
- ### greet Some("Alice")
10
- "Hello, Alice!"
2
+ Returns "Hello, World!"
11
3
  *)
12
- val greet: string option -> string
4
+ val hello: string
@@ -5,9 +5,7 @@ open Hello_world
5
5
  let ae exp got _test_ctxt = assert_equal ~printer:String.to_string exp got
6
6
 
7
7
  let tests = [
8
- "no name" >:: ae "Hello, World!" (greet None);
9
- "sample name" >:: ae "Hello, Alice!" (greet (Some "Alice"));
10
- "other sample name" >:: ae "Hello, Bob!" (greet (Some "Bob"));
8
+ "Say Hi!" >:: ae "Hello, World!" hello;
11
9
  ]
12
10
 
13
11
  let () =
@@ -10,27 +10,27 @@ let tests = [
10
10
  assert_valid false "1";
11
11
  "A single zero is invalid" >::
12
12
  assert_valid false "0";
13
- "simple valid sin" >::
14
- assert_valid true " 5 9 ";
15
- "valid Canadian SIN" >::
16
- assert_valid true "046 454 286";
13
+ "a simple valid SIN that remains valid if reversed" >::
14
+ assert_valid true "059";
15
+ "a simple valid SIN that becomes invalid if reversed" >::
16
+ assert_valid true "59";
17
+ "a valid Canadian SIN" >::
18
+ assert_valid true "055 444 285";
17
19
  "invalid Canadian SIN" >::
18
- assert_valid false "046 454 287";
20
+ assert_valid false "055 444 286";
19
21
  "invalid credit card" >::
20
22
  assert_valid false "8273 1232 7352 0569";
21
- "valid strings with a non-digit added become invalid" >::
22
- assert_valid false "046a 454 286";
23
- "punctuation is not allowed" >::
23
+ "valid strings with a non-digit included become invalid" >::
24
+ assert_valid false "055a 444 285";
25
+ "valid strings with punctuation included become invalid" >::
24
26
  assert_valid false "055-444-285";
25
- "symbols are not allowed" >::
27
+ "valid strings with symbols included become invalid" >::
26
28
  assert_valid false "055\194\163 444$ 285";
27
29
  "single zero with space is invalid" >::
28
30
  assert_valid false " 0";
29
- "lots of zeros are valid" >::
30
- assert_valid true " 00000";
31
- "another valid sin" >::
32
- assert_valid true "055 444 285";
33
- "nine doubled is nine" >::
31
+ "more than a single zero is valid" >::
32
+ assert_valid true "0000 0";
33
+ "input digit 9 is correctly converted to output digit 9" >::
34
34
  assert_valid true "091";
35
35
  ]
36
36
 
@@ -35,7 +35,8 @@ let parse_single (text: string) (expected_key: string) (cases_key: string): (tes
35
35
  Result.return (Single ts)
36
36
 
37
37
  let is_suite (json: json) (cases_key: string) =
38
- let keys = List.filter (keys json) ~f:(fun k -> k <> "methods") in
38
+ let ignorable_keys = ["exercise"; "version"; "methods"] in
39
+ let keys = List.filter (keys json) ~f:(Fn.non (List.mem ignorable_keys)) in
39
40
  let keys = List.sort keys ~cmp:String.compare in
40
41
  not (List.is_empty keys || keys = [cases_key] || keys = ["#"; cases_key])
41
42
 
@@ -6,7 +6,7 @@ let ae exp got _test_ctxt = assert_equal ~printer:String.to_string exp got
6
6
 
7
7
  let tests = [
8
8
  (* TEST
9
- "$description" >:: ae $expected (greet $name);
9
+ "$description" >:: ae $expected hello;
10
10
  END TEST *)
11
11
  ]
12
12
 
@@ -7,6 +7,7 @@ python:
7
7
  - 3.3
8
8
  - 3.4
9
9
  - 3.5
10
+ - 3.6
10
11
  - nightly
11
12
 
12
13
  matrix:
@@ -417,6 +417,31 @@
417
417
  "difficulty": 1,
418
418
  "topics": [
419
419
  ]
420
+ },
421
+ {
422
+ "slug": "all-your-base",
423
+ "difficulty": 4,
424
+ "topics": [
425
+ "integers",
426
+ "transforming"
427
+ ]
428
+ },
429
+ {
430
+ "slug": "grep",
431
+ "difficulty": 4,
432
+ "topics": [
433
+ "files",
434
+ "text formatting",
435
+ "searching"
436
+ ]
437
+ },
438
+ {
439
+ "slug": "word-search",
440
+ "difficulty": 6,
441
+ "topics": [
442
+ "strings",
443
+ "searching"
444
+ ]
420
445
  }
421
446
  ],
422
447
  "deprecated": [
@@ -0,0 +1,82 @@
1
+ import unittest
2
+
3
+ from all_your_base import rebase
4
+
5
+
6
+ class AllYourBaseTests(unittest.TestCase):
7
+
8
+ def test_single_bit_to_one_decimal(self):
9
+ self.assertEqual(rebase(2, [1], 10), [1])
10
+
11
+ def test_binary_to_single_decimal(self):
12
+ self.assertEqual(rebase(2, [1, 0, 1], 10), [5])
13
+
14
+ def test_single_decimal_to_binary(self):
15
+ self.assertEqual(rebase(10, [5], 2), [1, 0, 1])
16
+
17
+ def test_binary_to_multiple_decimal(self):
18
+ self.assertEqual(rebase(2, [1, 0, 1, 0, 1, 0], 10), [4, 2])
19
+
20
+ def test_decimal_to_binary(self):
21
+ self.assertEqual(rebase(10, [4, 2], 2), [1, 0, 1, 0, 1, 0])
22
+
23
+ def test_trinary_to_hexadecimal(self):
24
+ self.assertEqual(rebase(3, [1, 1, 2, 0], 16), [2, 10])
25
+
26
+ def test_hexadecimal_to_trinary(self):
27
+ self.assertEqual(rebase(16, [2, 10], 3), [1, 1, 2, 0])
28
+
29
+ def test_15_bit_integer(self):
30
+ self.assertEqual(rebase(97, [3, 46, 60], 73), [6, 10, 45])
31
+
32
+ def test_empty_list(self):
33
+ self.assertEqual(rebase(2, [], 10), [])
34
+
35
+ def test_single_zero(self):
36
+ self.assertEqual(rebase(10, [0], 2), [])
37
+
38
+ def test_multiple_zeroes(self):
39
+ self.assertEqual(rebase(10, [0, 0, 0], 2), [])
40
+
41
+ def test_leading_zeros(self):
42
+ self.assertEqual(rebase(7, [0, 6, 0], 10), [4, 2])
43
+
44
+ def test_negative_digit(self):
45
+ with self.assertRaises(ValueError):
46
+ rebase(2, [1, -1, 1, 0, 1, 0], 10)
47
+
48
+ def test_invalid_positive_digit(self):
49
+ with self.assertRaises(ValueError):
50
+ rebase(2, [1, 2, 1, 0, 1, 0], 10)
51
+
52
+ def test_first_base_is_one(self):
53
+ with self.assertRaises(ValueError):
54
+ rebase(1, [], 10)
55
+
56
+ def test_second_base_is_one(self):
57
+ with self.assertRaises(ValueError):
58
+ rebase(2, [1, 0, 1, 0, 1, 0], 1)
59
+
60
+ def test_first_base_is_zero(self):
61
+ with self.assertRaises(ValueError):
62
+ rebase(0, [], 10)
63
+
64
+ def test_second_base_is_zero(self):
65
+ with self.assertRaises(ValueError):
66
+ rebase(10, [7], 0)
67
+
68
+ def test_first_base_is_negative(self):
69
+ with self.assertRaises(ValueError):
70
+ rebase(-2, [1], 10)
71
+
72
+ def test_second_base_is_negative(self):
73
+ with self.assertRaises(ValueError):
74
+ rebase(2, [1], -7)
75
+
76
+ def test_both_bases_are_negative(self):
77
+ with self.assertRaises(ValueError):
78
+ rebase(-2, [1], -7)
79
+
80
+
81
+ if __name__ == '__main__':
82
+ unittest.main()