trackler 2.2.1.172 → 2.2.1.173
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/trackler/version.rb +1 -1
- data/tracks/ballerina/docs/ABOUT.md +2 -0
- data/tracks/ballerina/docs/INSTALLATION.md +1 -0
- data/tracks/ballerina/docs/LEARNING.md +1 -0
- data/tracks/ballerina/docs/TESTS.md +132 -0
- data/tracks/common-lisp/README.md +2 -2
- data/tracks/common-lisp/docs/SNIPPET.txt +4 -8
- data/tracks/factor/config.json +1 -0
- data/tracks/haskell/config.json +2 -1
- data/tracks/nim/exercises/allergies/allergies_test.nim +20 -21
- data/tracks/nim/exercises/anagram/anagram_test.nim +65 -63
- data/tracks/nim/exercises/binary/binary_test.nim +37 -36
- data/tracks/nim/exercises/bob/bob_test.nim +1 -1
- data/tracks/nim/exercises/bracket-push/bracket_push_test.nim +1 -1
- data/tracks/nim/exercises/difference-of-squares/difference_of_squares_test.nim +14 -12
- data/tracks/nim/exercises/gigasecond/example.nim +1 -1
- data/tracks/nim/exercises/gigasecond/gigasecond_test.nim +24 -24
- data/tracks/nim/exercises/hamming/hamming_test.nim +16 -14
- data/tracks/nim/exercises/hello-world/helloworld_test.nim +8 -6
- data/tracks/nim/exercises/leap/example.nim +1 -1
- data/tracks/nim/exercises/nucleotide-count/nucleotide_count_test.nim +19 -17
- data/tracks/nim/exercises/pangram/example.nim +3 -3
- data/tracks/nim/exercises/pangram/pangram_test.nim +11 -10
- data/tracks/nim/exercises/raindrops/raindrops_test.nim +35 -33
- data/tracks/nim/exercises/rna-transcription/rna_transcription_test.nim +15 -13
- data/tracks/nim/exercises/roman-numerals/example.nim +24 -25
- data/tracks/nim/exercises/roman-numerals/roman_numerals_test.nim +62 -28
- data/tracks/nim/exercises/scrabble-score/example.nim +6 -4
- data/tracks/nim/exercises/scrabble-score/scrabble_score_test.nim +13 -12
- data/tracks/nim/exercises/triangle/example.nim +15 -15
- data/tracks/nim/exercises/triangle/triangle_test.nim +14 -14
- data/tracks/python/exercises/simple-cipher/simple_cipher_test.py +3 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d13933224507907acc39a988d4809740f7077b1
|
4
|
+
data.tar.gz: 33199102a4c7cc41ec9a584c1c23c32eaafecbbf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b440036683246536de3cb0195d0ff8e81dcd878e518bce7072f96dbc797fff077176f8d7e0dd99171151ed273826a2c2afa2311a89bd7da1eddde47a0d7c0d9
|
7
|
+
data.tar.gz: b7bcafde26e04dd3024c2e59c953a3e02d49aa4dcc9a49e8531e59b78756f8361e895e1b2f5c83a70d0d87b3580ac1a34aa56019b767e541915600acaa54be7d
|
data/lib/trackler/version.rb
CHANGED
@@ -0,0 +1,2 @@
|
|
1
|
+
[Ballerina](https://ballerina.io/) is a compiled, transactional, statically and strongly typed programming language with textual and graphical syntaxes. Ballerina incorporates fundamental concepts of distributed system integration into the language and offers a type safe, concurrent environment to implement microservices with distributed transactions, reliable messaging, stream processing, and workflows.
|
2
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
You can install Ballerina by following the Ballerina [installation guide](https://ballerina.io/learn/getting-started/).
|
@@ -0,0 +1 @@
|
|
1
|
+
Ballerina [learn](https://ballerina.io/learn/#learning-ballerina) page contains multiple resource you to get up to speed with the language, master the concepts and build comprehensive real world use cases.
|
@@ -0,0 +1,132 @@
|
|
1
|
+
# Running the Tests
|
2
|
+
|
3
|
+
Choose your operating system:
|
4
|
+
|
5
|
+
* [Windows](#windows)
|
6
|
+
* [Mac OS X](#mac-os-x)
|
7
|
+
* [Linux](#linux)
|
8
|
+
|
9
|
+
----
|
10
|
+
|
11
|
+
# Windows
|
12
|
+
|
13
|
+
1. Open a Command Prompt and get the first exercise:
|
14
|
+
|
15
|
+
```batchfile
|
16
|
+
C:\Users\JohnDoe>exercism fetch ballerina
|
17
|
+
|
18
|
+
Not Submitted: 1 problem
|
19
|
+
ballerina (Hello World) C:\Users\JohnDoe\exercism\ballerina\hello-world
|
20
|
+
|
21
|
+
New: 1 problem
|
22
|
+
ballerina (Hello World) C:\Users\JohnDoe\exercism\ballerina\hello-world
|
23
|
+
|
24
|
+
unchanged: 0, updated: 0, new: 1
|
25
|
+
```
|
26
|
+
|
27
|
+
2. Change directory into the ballerina exercism main directory:
|
28
|
+
|
29
|
+
```batchfile
|
30
|
+
C:\Users\JohnDoe>cd C:\Users\JohnDoe\exercism\ballerina
|
31
|
+
```
|
32
|
+
3. Initialize the project prior to executing tests:
|
33
|
+
|
34
|
+
```batchfile
|
35
|
+
C:\Users\JohnDoe\exercism\ballerina> ballerina init
|
36
|
+
```
|
37
|
+
|
38
|
+
4. Run the tests:
|
39
|
+
|
40
|
+
```batchfile
|
41
|
+
C:\Users\JohnDoe\exercism\ballerina>ballerina test hello-world
|
42
|
+
```
|
43
|
+
*(Don't worry about the tests failing, at first, this is how you begin each exercise.)*
|
44
|
+
|
45
|
+
5. Solve the exercise. Find and work through the `TUTORIAL.md` guide ([view on GitHub](https://github.com/exercism/ballerina/blob/master/exercises/hello-world/TUTORIAL.md)).
|
46
|
+
|
47
|
+
|
48
|
+
Good luck! Have fun!
|
49
|
+
|
50
|
+
If you get stuck, at any point, don't forget to reach out for [help](http://exercism.io/languages/ballerina/help).
|
51
|
+
|
52
|
+
----
|
53
|
+
|
54
|
+
# Mac OS X
|
55
|
+
|
56
|
+
1. In the terminal window, get the first exercise:
|
57
|
+
|
58
|
+
```
|
59
|
+
$ exercism fetch ballerina
|
60
|
+
|
61
|
+
New: 1 problem
|
62
|
+
ballerina (Etl) /Users/johndoe/exercism/ballerina/hello-world
|
63
|
+
|
64
|
+
unchanged: 0, updated: 0, new: 1
|
65
|
+
```
|
66
|
+
|
67
|
+
2. Change directory into the ballerina exercism main directory:
|
68
|
+
|
69
|
+
```
|
70
|
+
$ cd /Users/johndoe/exercism/ballerina
|
71
|
+
```
|
72
|
+
|
73
|
+
|
74
|
+
3. Initialize the project prior to executing tests:
|
75
|
+
|
76
|
+
```batchfile
|
77
|
+
/Users/johndoe/exercism/ballerina $ ballerina init
|
78
|
+
```
|
79
|
+
|
80
|
+
4. Run the tests:
|
81
|
+
|
82
|
+
```
|
83
|
+
/Users/johndoe/exercism/ballerina $ ballerina test hello-world
|
84
|
+
```
|
85
|
+
*(Don't worry about the tests failing, at first, this is how you begin each exercise.)*
|
86
|
+
|
87
|
+
5. Solve the exercise. Find and work through the `TUTORIAL.md` guide ([view on GitHub](https://github.com/exercism/ballerina/blob/master/exercises/hello-world/TUTORIAL.md)).
|
88
|
+
|
89
|
+
Good luck! Have fun!
|
90
|
+
|
91
|
+
If you get stuck, at any point, don't forget to reach out for [help](http://exercism.io/languages/ballerina/help).
|
92
|
+
|
93
|
+
----
|
94
|
+
|
95
|
+
# Linux
|
96
|
+
|
97
|
+
1. In the terminal window, get the first exercise:
|
98
|
+
|
99
|
+
```
|
100
|
+
$ exercism fetch ballerina
|
101
|
+
|
102
|
+
New: 1 problem
|
103
|
+
ballerina (Etl) /home/johndoe/exercism/ballerina/hello-world
|
104
|
+
|
105
|
+
unchanged: 0, updated: 0, new: 1
|
106
|
+
|
107
|
+
```
|
108
|
+
|
109
|
+
2. Change directory into the exercise:
|
110
|
+
|
111
|
+
```
|
112
|
+
$ cd /home/johndoe/exercism/ballerina/hello-world
|
113
|
+
```
|
114
|
+
|
115
|
+
3. Initialize the project prior to executing tests:
|
116
|
+
|
117
|
+
```batchfile
|
118
|
+
/home/johndoe/exercism/ballerina $ ballerina init
|
119
|
+
```
|
120
|
+
|
121
|
+
4. Run the tests:
|
122
|
+
|
123
|
+
```
|
124
|
+
/home/johndoe/exercism/ballerina $ ballerina test hello-world
|
125
|
+
```
|
126
|
+
*(Don't worry about the tests failing, at first, this is how you begin each exercise.)*
|
127
|
+
|
128
|
+
5. Solve the exercise. Find and work through the `TUTORIAL.md` guide ([view on GitHub](https://github.com/exercism/ballerina/blob/master/exercises/hello-world/TUTORIAL.md)).
|
129
|
+
|
130
|
+
Good luck! Have fun!
|
131
|
+
|
132
|
+
If you get stuck, at any point, don't forget to reach out for [help](http://exercism.io/languages/ballerina/help).
|
@@ -1,11 +1,11 @@
|
|
1
|
-
#
|
1
|
+
# Common Lisp
|
2
2
|
|
3
3
|
[![Build Status](https://travis-ci.org/exercism/common-lisp.svg)](https://travis-ci.org/exercism/common-lisp)
|
4
4
|
|
5
5
|
Exercism exercises in Lisp
|
6
6
|
|
7
7
|
|
8
|
-
## Contributing
|
8
|
+
## Contributing to the Common Lisp Track
|
9
9
|
|
10
10
|
### Contributing Guide
|
11
11
|
|
@@ -1,11 +1,7 @@
|
|
1
|
-
(
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
(in-package #:hamming)
|
6
|
-
|
7
|
-
(defun distance (str1 str2 &key (test #'char=))
|
8
|
-
"Number of positional differences in two equal length strings."
|
1
|
+
(defun distance (str1 str2
|
2
|
+
&key (test #'char=))
|
3
|
+
"Number of positional differences in
|
4
|
+
two equal length strings."
|
9
5
|
(when (= (length str1) (length str2))
|
10
6
|
(count nil
|
11
7
|
(map 'list test str1 str2))))
|
data/tracks/factor/config.json
CHANGED
data/tracks/haskell/config.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"language": "Haskell",
|
3
3
|
"active": true,
|
4
|
-
"blurb": "",
|
4
|
+
"blurb": "Haskell is a functional programming language which is pure and statically-typed. It's known for lazy evaluation, where evaluation is deferred until necessary, and its purity, where monads are used for working with side-effects.",
|
5
5
|
"ignore_pattern": "example",
|
6
6
|
"solution_pattern": "example.*[.]hs",
|
7
7
|
"exercises": [
|
@@ -9,6 +9,7 @@
|
|
9
9
|
"slug": "hello-world",
|
10
10
|
"uuid": "c97d9dda-c7ee-4595-b447-693559d03ba5",
|
11
11
|
"core": false,
|
12
|
+
"auto_approve": true,
|
12
13
|
"unlocked_by": null,
|
13
14
|
"difficulty": 1,
|
14
15
|
"topics": null
|
@@ -3,66 +3,65 @@ import unittest
|
|
3
3
|
import allergies
|
4
4
|
|
5
5
|
|
6
|
-
|
6
|
+
suite "Allergies":
|
7
|
+
|
8
|
+
test "no allergies means not allergic":
|
7
9
|
let allergies = Allergies(score: 0)
|
8
10
|
check allergies.isAllergicTo("peanuts") == false
|
9
11
|
check allergies.isAllergicTo("cats") == false
|
10
12
|
check allergies.isAllergicTo("strawberries") == false
|
11
13
|
|
12
|
-
test "is allergic to eggs":
|
14
|
+
test "is allergic to eggs":
|
13
15
|
let allergies = Allergies(score: 1)
|
14
16
|
check allergies.isAllergicTo("eggs") == true
|
15
17
|
|
16
|
-
test "allergic to eggs in addition to other stuff":
|
18
|
+
test "allergic to eggs in addition to other stuff":
|
17
19
|
let allergies = Allergies(score: 5)
|
18
20
|
check allergies.isAllergicTo("eggs") == true
|
19
21
|
check allergies.isAllergicTo("shellfish") == true
|
20
22
|
check allergies.isAllergicTo("strawberries") == false
|
21
23
|
|
22
|
-
test "no allergies at all":
|
24
|
+
test "no allergies at all":
|
23
25
|
let allergies = Allergies(score: 0)
|
24
26
|
check allergies.lst == newSeq[string](0)
|
25
27
|
|
26
|
-
test "allergic to just eggs":
|
28
|
+
test "allergic to just eggs":
|
27
29
|
let allergies = Allergies(score: 1)
|
28
30
|
check allergies.lst == @["eggs"]
|
29
31
|
|
30
|
-
test "allergic to just peanuts":
|
32
|
+
test "allergic to just peanuts":
|
31
33
|
let allergies = Allergies(score: 2)
|
32
34
|
check allergies.lst == @["peanuts"]
|
33
35
|
|
34
|
-
test "allergic to just strawberries":
|
36
|
+
test "allergic to just strawberries":
|
35
37
|
let allergies = Allergies(score: 8)
|
36
38
|
check allergies.lst == @["strawberries"]
|
37
39
|
|
38
|
-
test "allergic to eggs and peanuts":
|
40
|
+
test "allergic to eggs and peanuts":
|
39
41
|
let allergies = Allergies(score: 3)
|
40
42
|
check allergies.lst == @["eggs", "peanuts"]
|
41
43
|
|
42
|
-
test "allergic to more than eggs but not peanuts":
|
44
|
+
test "allergic to more than eggs but not peanuts":
|
43
45
|
let allergies = Allergies(score: 5)
|
44
46
|
check allergies.lst == @["eggs", "shellfish"]
|
45
47
|
|
46
|
-
test "allergic to lots of stuff":
|
48
|
+
test "allergic to lots of stuff":
|
47
49
|
let allergies = Allergies(score: 248)
|
48
50
|
check allergies.lst == @[
|
49
|
-
|
50
|
-
]
|
51
|
+
"strawberries", "tomatoes", "chocolate", "pollen", "cats"]
|
51
52
|
|
52
|
-
test "allergic to everything":
|
53
|
+
test "allergic to everything":
|
53
54
|
let allergies = Allergies(score: 255)
|
54
55
|
check allergies.lst == @[
|
55
|
-
|
56
|
-
|
57
|
-
]
|
56
|
+
"eggs", "peanuts", "shellfish", "strawberries", "tomatoes",
|
57
|
+
"chocolate", "pollen", "cats"]
|
58
58
|
|
59
|
-
test "ignore non allergen score parts only eggs":
|
59
|
+
test "ignore non allergen score parts only eggs":
|
60
60
|
let allergies = Allergies(score: 257)
|
61
61
|
check allergies.lst == @["eggs"]
|
62
62
|
|
63
|
-
test "ignore non allergen score parts":
|
63
|
+
test "ignore non allergen score parts":
|
64
64
|
let allergies = Allergies(score: 509)
|
65
65
|
check allergies.lst == @[
|
66
|
-
|
67
|
-
|
68
|
-
]
|
66
|
+
"eggs", "shellfish", "strawberries", "tomatoes", "chocolate",
|
67
|
+
"pollen", "cats"]
|
@@ -1,74 +1,76 @@
|
|
1
1
|
import unittest
|
2
2
|
from anagram import detectAnagrams
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
4
|
+
suite "Anagram":
|
5
|
+
|
6
|
+
test "no matches":
|
7
|
+
let
|
8
|
+
word = "diaper"
|
9
|
+
candidates = @["hello", "world", "zombies", "pants"]
|
10
|
+
expected: seq[string] = @[]
|
11
|
+
detected = detectAnagrams(word, candidates)
|
12
|
+
check detected == expected
|
11
13
|
|
12
|
-
test "detect simple anagram":
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
14
|
+
test "detect simple anagram":
|
15
|
+
let
|
16
|
+
word = "ant"
|
17
|
+
candidates = @["tan", "stand", "at"]
|
18
|
+
expected = @["tan"]
|
19
|
+
detected = detectAnagrams(word, candidates)
|
20
|
+
check detected == expected
|
19
21
|
|
20
|
-
test "detect multiple anagrams":
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
22
|
+
test "detect multiple anagrams":
|
23
|
+
let
|
24
|
+
word = "master"
|
25
|
+
candidates = @["stream", "pigeon", "maters"]
|
26
|
+
expected = @["stream", "maters"]
|
27
|
+
detected = detectAnagrams(word, candidates)
|
28
|
+
check detected == expected
|
27
29
|
|
28
|
-
test "does not confuse different duplicate characters":
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
30
|
+
test "does not confuse different duplicate characters":
|
31
|
+
let
|
32
|
+
word = "galea"
|
33
|
+
candidates = @["eagle"]
|
34
|
+
expected: seq[string] = @[]
|
35
|
+
detected = detectAnagrams(word, candidates)
|
36
|
+
check detected == expected
|
35
37
|
|
36
|
-
test "eliminate anagram subsets":
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
38
|
+
test "eliminate anagram subsets":
|
39
|
+
let
|
40
|
+
word = "good"
|
41
|
+
candidates = @["dog", "goody"]
|
42
|
+
expected: seq[string] = @[]
|
43
|
+
detected = detectAnagrams(word, candidates)
|
44
|
+
check detected == expected
|
43
45
|
|
44
|
-
test "detect anagram":
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
46
|
+
test "detect anagram":
|
47
|
+
let
|
48
|
+
word = "listen"
|
49
|
+
candidates = @["enlists", "google", "inlets", "banana"]
|
50
|
+
expected = @["inlets"]
|
51
|
+
detected = detectAnagrams(word, candidates)
|
52
|
+
check detected == expected
|
51
53
|
|
52
|
-
test "multiple anagrams":
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
54
|
+
test "multiple anagrams":
|
55
|
+
let
|
56
|
+
word = "allergy"
|
57
|
+
candidates = @["gallery", "ballerina", "regally", "clergy", "largely", "leading"]
|
58
|
+
expected = @["gallery", "regally", "largely"]
|
59
|
+
detected = detectAnagrams(word, candidates)
|
60
|
+
check detected == expected
|
59
61
|
|
60
|
-
test "anagrams are case insensitive":
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
62
|
+
test "anagrams are case insensitive":
|
63
|
+
let
|
64
|
+
word = "Orchestra"
|
65
|
+
candidates = @["cashregister", "Carthorse", "radishes"]
|
66
|
+
expected = @["Carthorse"]
|
67
|
+
detected = detectAnagrams(word, candidates)
|
68
|
+
check detected == expected
|
67
69
|
|
68
|
-
test "same word isn't anagram":
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
70
|
+
test "same word isn't anagram":
|
71
|
+
let
|
72
|
+
word = "go"
|
73
|
+
candidates = @["go", "Go", "GO"]
|
74
|
+
expected: seq[string] = @[]
|
75
|
+
detected = detectAnagrams(word, candidates)
|
76
|
+
check detected == expected
|
@@ -1,54 +1,55 @@
|
|
1
1
|
import unittest
|
2
2
|
import binary
|
3
3
|
|
4
|
+
suite "Binary":
|
4
5
|
|
5
|
-
test "binary 0 is decimal 0":
|
6
|
-
|
6
|
+
test "binary 0 is decimal 0":
|
7
|
+
check binary("0") == 0
|
7
8
|
|
8
|
-
test "binary 1 is decimal 1":
|
9
|
-
|
9
|
+
test "binary 1 is decimal 1":
|
10
|
+
check binary("1") == 1
|
10
11
|
|
11
|
-
test "binary 10 is decimal 2":
|
12
|
-
|
12
|
+
test "binary 10 is decimal 2":
|
13
|
+
check binary("10") == 2
|
13
14
|
|
14
|
-
test "binary 11 is decimal 3":
|
15
|
-
|
15
|
+
test "binary 11 is decimal 3":
|
16
|
+
check binary("11") == 3
|
16
17
|
|
17
|
-
test "binary 100 is decimal 4":
|
18
|
-
|
18
|
+
test "binary 100 is decimal 4":
|
19
|
+
check binary("100") == 4
|
19
20
|
|
20
|
-
test "binary 1001 is decimal 9":
|
21
|
-
|
21
|
+
test "binary 1001 is decimal 9":
|
22
|
+
check binary("1001") == 9
|
22
23
|
|
23
|
-
test "binary 11010 is decimal 26":
|
24
|
-
|
24
|
+
test "binary 11010 is decimal 26":
|
25
|
+
check binary("11010") == 26
|
25
26
|
|
26
|
-
test "binary 10001101000 is decimal 1128":
|
27
|
-
|
27
|
+
test "binary 10001101000 is decimal 1128":
|
28
|
+
check binary("10001101000") == 1128
|
28
29
|
|
29
|
-
test "binary ignores leading zeros":
|
30
|
-
|
30
|
+
test "binary ignores leading zeros":
|
31
|
+
check binary("000011111") == 31
|
31
32
|
|
32
|
-
test "2 is not a valid binary digit":
|
33
|
-
|
34
|
-
|
33
|
+
test "2 is not a valid binary digit":
|
34
|
+
expect(ValueError):
|
35
|
+
discard binary("2")
|
35
36
|
|
36
|
-
test "a number containing a non-binary digit is invalid":
|
37
|
-
|
38
|
-
|
37
|
+
test "a number containing a non-binary digit is invalid":
|
38
|
+
expect(ValueError):
|
39
|
+
discard binary("01201")
|
39
40
|
|
40
|
-
test "a number with trailing non-binary characters is invalid":
|
41
|
-
|
42
|
-
|
41
|
+
test "a number with trailing non-binary characters is invalid":
|
42
|
+
expect(ValueError):
|
43
|
+
discard binary("10nope")
|
43
44
|
|
44
|
-
test "a number with leading non-binary characters is invalid":
|
45
|
-
|
46
|
-
|
45
|
+
test "a number with leading non-binary characters is invalid":
|
46
|
+
expect(ValueError):
|
47
|
+
discard binary("nope10")
|
47
48
|
|
48
|
-
test "a number with internal non-binary characters is invalid":
|
49
|
-
|
50
|
-
|
49
|
+
test "a number with internal non-binary characters is invalid":
|
50
|
+
expect(ValueError):
|
51
|
+
discard binary("10nope10")
|
51
52
|
|
52
|
-
test "a number and a word whitespace spearated is invalid":
|
53
|
-
|
54
|
-
|
53
|
+
test "a number and a word whitespace spearated is invalid":
|
54
|
+
expect(ValueError):
|
55
|
+
discard binary("001 nope")
|
@@ -1,20 +1,22 @@
|
|
1
1
|
import unittest
|
2
2
|
import difference_of_squares
|
3
3
|
|
4
|
-
|
5
|
-
check squareOfSum(5) == 225
|
4
|
+
suite "Difference of Squares":
|
6
5
|
|
7
|
-
test "
|
8
|
-
|
6
|
+
test "square of sum, 5":
|
7
|
+
check squareOfSum(5) == 225
|
9
8
|
|
10
|
-
test "
|
11
|
-
|
9
|
+
test "sum of squares, 5":
|
10
|
+
check sumOfSquares(5) == 55
|
12
11
|
|
13
|
-
test "
|
14
|
-
|
12
|
+
test "difference, 5":
|
13
|
+
check difference(5) == 170
|
15
14
|
|
16
|
-
test "
|
17
|
-
|
15
|
+
test "square of sum, 100":
|
16
|
+
check squareOfSum(100) == 25502500
|
18
17
|
|
19
|
-
test "
|
20
|
-
|
18
|
+
test "sum of squares, 100":
|
19
|
+
check sumOfSquares(100) == 338350
|
20
|
+
|
21
|
+
test "difference, 100":
|
22
|
+
check difference(100) == 25164150
|
@@ -4,29 +4,29 @@ import gigasecond
|
|
4
4
|
|
5
5
|
suite "Gigasecond":
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
7
|
+
test "date only specification of time":
|
8
|
+
let birthday = initDateTime(25, mApr, 2011, 0, 0, 0, utc())
|
9
|
+
let expected = initDateTime(1, mJan, 2043, 1, 46, 40, utc())
|
10
|
+
check addGigasecond(birthday) == expected
|
11
|
+
|
12
|
+
test "second test for date only specification of time":
|
13
|
+
let birthday = initDateTime(13, mJun, 1977, 0, 0, 0, utc())
|
14
|
+
let expected = initDateTime(19, mFeb, 2009, 1, 46, 40, utc())
|
15
|
+
check addGigasecond(birthday) == expected
|
16
|
+
|
17
|
+
test "third test for date only specification of time":
|
18
|
+
let birthday = initDateTime(19, mJul, 1959, 0, 0, 0, utc())
|
19
|
+
let expected = initDateTime(27, mMar, 1991, 1, 46, 40, utc())
|
20
|
+
check addGigasecond(birthday) == expected
|
21
|
+
|
22
|
+
test "full time specified":
|
23
|
+
let birthday = initDateTime(24, mJan, 2015, 22, 0, 0, utc())
|
24
|
+
let expected = initDateTime(2, mOct, 2046, 23, 46, 40, utc())
|
25
|
+
check addGigasecond(birthday) == expected
|
26
|
+
|
27
|
+
test "full time with day roll-over":
|
28
|
+
let birthday = initDateTime(24, mJan, 2015, 23, 59, 59, utc())
|
29
|
+
let expected = initDateTime(3, mOct, 2046, 1, 46, 39, utc())
|
30
|
+
check addGigasecond(birthday) == expected
|
31
31
|
|
32
32
|
|