trackler 2.2.1.86 → 2.2.1.87
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/metadata.yml +0 -1
- data/tracks/bash/CONTRIBUTING.md +129 -28
- data/tracks/bash/config/exercise_readme.go.tmpl +10 -4
- data/tracks/bash/exercises/acronym/README.md +8 -11
- data/tracks/bash/exercises/acronym/{acronym_tests.sh → acronym_test.sh} +0 -0
- data/tracks/bash/exercises/anagram/README.md +6 -1
- data/tracks/bash/exercises/anagram/anagram_test.sh +1 -1
- data/tracks/bash/exercises/armstrong-numbers/README.md +10 -2
- data/tracks/bash/exercises/atbash-cipher/README.md +6 -6
- data/tracks/bash/exercises/bob/README.md +8 -1
- data/tracks/bash/exercises/collatz-conjecture/README.md +11 -2
- data/tracks/bash/exercises/collatz-conjecture/{collatz_test.sh → collatz_conjecture_test.sh} +6 -6
- data/tracks/bash/exercises/difference-of-squares/README.md +6 -1
- data/tracks/bash/exercises/error-handling/README.md +13 -5
- data/tracks/bash/exercises/error-handling/error_handling_test.sh +18 -22
- data/tracks/bash/exercises/error-handling/example.sh +7 -6
- data/tracks/bash/exercises/gigasecond/.meta/hints.md +0 -5
- data/tracks/bash/exercises/gigasecond/README.md +36 -1
- data/tracks/bash/exercises/grains/README.md +10 -2
- data/tracks/bash/exercises/hamming/README.md +6 -1
- data/tracks/bash/exercises/hello-world/README.md +7 -2
- data/tracks/bash/exercises/leap/README.md +7 -2
- data/tracks/bash/exercises/luhn/README.md +7 -2
- data/tracks/bash/exercises/nucleotide-count/README.md +13 -22
- data/tracks/bash/exercises/pangram/README.md +7 -2
- data/tracks/bash/exercises/phone-number/README.md +10 -4
- data/tracks/bash/exercises/raindrops/README.md +6 -1
- data/tracks/bash/exercises/reverse-string/README.md +11 -2
- data/tracks/bash/exercises/rna-transcription/README.md +7 -2
- data/tracks/bash/exercises/roman-numerals/README.md +11 -2
- data/tracks/bash/exercises/triangle/README.md +5 -4
- data/tracks/bash/exercises/two-fer/README.md +7 -9
- data/tracks/bash/exercises/word-count/README.md +6 -2
- data/tracks/bash/exercises/word-count/example.sh +22 -13
- data/tracks/bash/scripts/canonical_data_check.sh +112 -0
- data/tracks/c/exercises/acronym/src/{example.h → acronym.h} +0 -0
- data/tracks/c/exercises/gigasecond/.meta/hints.md +124 -0
- data/tracks/c/exercises/gigasecond/README.md +126 -0
- data/tracks/c/exercises/isogram/src/{example.h → isogram.h} +0 -0
- data/tracks/c/exercises/meetup/.meta/hints.md +124 -0
- data/tracks/c/exercises/meetup/README.md +142 -12
- data/tracks/c/exercises/pangram/src/{example.h → pangram.h} +0 -0
- data/tracks/c/exercises/space-age/.meta/hints.md +124 -0
- data/tracks/c/exercises/space-age/README.md +127 -2
- data/tracks/elisp/bin/test-examples +11 -14
- data/tracks/elisp/config.json +9 -1
- data/tracks/elisp/exercises/acronym/README.md +13 -0
- data/tracks/elisp/exercises/acronym/acronym-test.el +28 -0
- data/tracks/elisp/exercises/acronym/acronym.el +11 -0
- data/tracks/elisp/exercises/acronym/example.el +14 -0
- data/tracks/elisp/exercises/bob/example.el +1 -3
- data/tracks/elisp/exercises/hamming/README.md +2 -0
- data/tracks/elisp/exercises/hamming/hamming-test.el +35 -12
- data/tracks/elisp/exercises/hamming/hamming.el +0 -3
- data/tracks/fsharp/exercises/custom-set/CustomSetTest.fs +206 -132
- data/tracks/fsharp/exercises/custom-set/Example.fs +2 -0
- data/tracks/fsharp/generators/Generators.fs +61 -0
- data/tracks/go/config.json +25 -2
- data/tracks/go/exercises/acronym/acronym_test.go +8 -0
- data/tracks/go/exercises/alphametics/.meta/gen.go +72 -0
- data/tracks/go/exercises/alphametics/.meta/hints.md +38 -0
- data/tracks/go/exercises/alphametics/README.md +93 -0
- data/tracks/go/exercises/alphametics/alphametics_test.go +33 -0
- data/tracks/go/exercises/alphametics/cases_test.go +59 -0
- data/tracks/go/exercises/alphametics/example.go +212 -0
- data/tracks/go/exercises/atbash-cipher/.meta/gen.go +6 -4
- data/tracks/go/exercises/atbash-cipher/cases_test.go +2 -2
- data/tracks/go/exercises/change/.meta/gen.go +7 -5
- data/tracks/go/exercises/change/cases_test.go +2 -2
- data/tracks/go/exercises/collatz-conjecture/.meta/gen.go +5 -3
- data/tracks/go/exercises/collatz-conjecture/cases_test.go +2 -2
- data/tracks/go/exercises/connect/.meta/gen.go +5 -3
- data/tracks/go/exercises/connect/cases_test.go +2 -2
- data/tracks/go/exercises/flatten-array/.meta/gen.go +5 -3
- data/tracks/go/exercises/flatten-array/cases_test.go +2 -2
- data/tracks/go/exercises/meetup/.meta/gen.go +19 -8
- data/tracks/go/exercises/meetup/cases_test.go +2 -2
- data/tracks/go/exercises/simple-linked-list/README.md +47 -0
- data/tracks/go/exercises/simple-linked-list/example.go +74 -0
- data/tracks/go/exercises/simple-linked-list/linked_list_test.go +210 -0
- data/tracks/idris/config.json +2 -2
- data/tracks/java/exercises/all-your-base/.meta/src/reference/java/BaseConverter.java +1 -5
- data/tracks/java/exercises/all-your-base/.meta/version +1 -1
- data/tracks/java/exercises/all-your-base/src/test/java/BaseConverterTest.java +34 -10
- data/tracks/java/exercises/bob/README.md +2 -0
- data/tracks/java/exercises/kindergarten-garden/.meta/version +1 -0
- data/tracks/java/exercises/kindergarten-garden/src/test/java/KindergartenGardenTest.java +0 -55
- data/tracks/java/exercises/meetup/.meta/version +1 -0
- data/tracks/java/exercises/meetup/src/test/java/MeetupTest.java +32 -0
- data/tracks/java/exercises/parallel-letter-frequency/README.md +1 -0
- data/tracks/java/exercises/proverb/README.md +16 -10
- data/tracks/java/exercises/rail-fence-cipher/README.md +5 -6
- data/tracks/java/exercises/two-fer/README.md +1 -1
- data/tracks/java/exercises/word-search/.meta/version +1 -1
- data/tracks/java/exercises/word-search/src/test/java/WordSearcherTest.java +240 -2
- data/tracks/javascript/.eslintignore +0 -1
- data/tracks/javascript/exercises/palindrome-products/example.js +3 -3
- data/tracks/kotlin/docs/INSTALLATION.md +77 -68
- data/tracks/kotlin/docs/TESTS.md +41 -39
- data/tracks/perl6/exercises/acronym/acronym.t +20 -8
- data/tracks/perl6/exercises/acronym/example.yaml +1 -1
- data/tracks/perl6/exercises/all-your-base/all-your-base.t +108 -66
- data/tracks/perl6/exercises/all-your-base/example.yaml +2 -2
- data/tracks/perl6/exercises/allergies/allergies.t +39 -15
- data/tracks/perl6/exercises/allergies/example.yaml +2 -2
- data/tracks/perl6/exercises/anagram/anagram.t +73 -40
- data/tracks/perl6/exercises/anagram/example.yaml +1 -1
- data/tracks/perl6/exercises/atbash-cipher/atbash-cipher.t +38 -15
- data/tracks/perl6/exercises/atbash-cipher/example.yaml +1 -1
- data/tracks/perl6/exercises/bob/bob.t +77 -27
- data/tracks/perl6/exercises/bob/example.yaml +1 -1
- data/tracks/perl6/exercises/flatten-array/example.yaml +1 -1
- data/tracks/perl6/exercises/flatten-array/flatten-array.t +20 -8
- data/tracks/perl6/exercises/luhn/example.yaml +1 -1
- data/tracks/perl6/exercises/luhn/luhn.t +42 -16
- data/tracks/perl6/exercises/roman-numerals/README.md +68 -0
- data/tracks/php/exercises/gigasecond/gigasecond_test.php +1 -1
- data/tracks/python/docs/ABOUT.md +2 -2
- metadata +27 -10
- data/tracks/bash/docs/EXERCISE_README_INSERT.md +0 -3
- data/tracks/bash/exercises/word-count/example.awk +0 -12
- data/tracks/java/exercises/alphametics/src/main/java/.keep +0 -0
|
@@ -12,12 +12,137 @@ Given an age in seconds, calculate how old someone would be on:
|
|
|
12
12
|
- Neptune: orbital period 164.79132 Earth years
|
|
13
13
|
|
|
14
14
|
So if you were told someone were 1,000,000,000 seconds old, you should
|
|
15
|
-
be able to say that they're 31.69 Earth-years old.
|
|
16
|
-
the nearest hundredth of a year.
|
|
15
|
+
be able to say that they're 31.69 Earth-years old.
|
|
17
16
|
|
|
18
17
|
If you're wondering why Pluto didn't make the cut, go watch [this
|
|
19
18
|
youtube video](http://www.youtube.com/watch?v=Z_2gbGXzFbs).
|
|
20
19
|
|
|
20
|
+
## Exercises without stub implementations
|
|
21
|
+
|
|
22
|
+
Like the majority of C programs you will write, this exercise comes without any header file (`*.h`) or source file (`*.c`).
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Add the required files
|
|
26
|
+
|
|
27
|
+
You will need to create these yourself as part of the exercise.
|
|
28
|
+
This is so that you get to practice deciding on and creating the program's interface yourself, which is an important part of programming in C.
|
|
29
|
+
It does mean that when you first try to run the tests, they won't compile.
|
|
30
|
+
They will give you an error similar to:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
make: *** No rule to make target 'src/exercise_name.c', needed by 'tests.out'. Stop.
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
This error occurs because the `makefile` attempts to use a file that hasn't been created yet (`exercise_name.c`).
|
|
37
|
+
To resolve this error you will need to add a matching file to the `src` directory.
|
|
38
|
+
For example, for the error above you would add a file called `exercise_name.c`.
|
|
39
|
+
|
|
40
|
+
When you try to run the tests again you will get a slightly different error.
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
make: *** No rule to make target 'src/exercise_name.h', needed by 'tests.out'. Stop.
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Again the `makefile` still needs another file that has yet to be created (`exercise_name.h`).
|
|
47
|
+
The solution to this error is similar to the last, add the matching file to the `src` directory.
|
|
48
|
+
For example, for the above error you would add a file called `exercise_name.h`
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
### Add the required declarations
|
|
52
|
+
|
|
53
|
+
Running the tests a third time you see you will get new errors, similar to:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
Compiling tests.out
|
|
57
|
+
src/exercise_name.c:1:0: error: ISO C forbids an empty translation unit [-Werror=pedantic]
|
|
58
|
+
cc1: all warnings being treated as errors
|
|
59
|
+
test/test_exercise_name.c:13:1: error: unknown type name ‘bar_t’; did you mean ‘__bar_t’?
|
|
60
|
+
bar_t b = foo(a, 2.5);
|
|
61
|
+
^~~~~~
|
|
62
|
+
__bar_t
|
|
63
|
+
test/test_exercise_name.c:15:14: error: storage size of fizz isn’t known
|
|
64
|
+
struct baz fizz;
|
|
65
|
+
^~~~
|
|
66
|
+
test/test_exercise_name.c:29:20: error: implicit declaration of function ‘foo’ [-Werror=implicit-function-declaration]
|
|
67
|
+
bar_t b = foo_function(fizz, 2.5);
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
This error means that you need to add function, type and variable decarations to the header file to match those the test file is attempting to use.
|
|
71
|
+
In doing this you will need to look at the build errors and the test code to determine what needs to be declared in the header file.
|
|
72
|
+
|
|
73
|
+
For example, for the error above you should declare a type named `bar_t`, a `struct` called `baz` and a function named `foo()`.
|
|
74
|
+
Additionally we can tell from looking at the above errors that function `foo()` has two parameters.
|
|
75
|
+
|
|
76
|
+
The first parameter is passed an argument of `fizz` and thus should have a type of `struct baz`.
|
|
77
|
+
The second parameter is passed `2.5` and so could have one of two types, either `float` or `double`.
|
|
78
|
+
You will need to look at the test code to determine which.
|
|
79
|
+
|
|
80
|
+
The _names_ of the parameters are not determined by the test code and so are left up to you to decide, though in keeping with C programming practices they should be descriptive but not overly long.
|
|
81
|
+
|
|
82
|
+
Further, we can see that the the return type expected by the test code is of the type `bar_t`.
|
|
83
|
+
|
|
84
|
+
Putting this all together we end up with a function declaration that looks like the following:
|
|
85
|
+
|
|
86
|
+
```c
|
|
87
|
+
// The parameter names are not very good here they should be more descriptive in a real exercise.
|
|
88
|
+
// We have decide on a double for the second parameter in this hypothetical example.
|
|
89
|
+
bar_t foo(struct baz b, double d);
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
You should continue to do this for any further similar errors.
|
|
93
|
+
To check that you have correctly determined the required declaration, just run the tests again and analyse any errors similarly.
|
|
94
|
+
|
|
95
|
+
Additionally, remember to add any includes to the header file any headers that it itself requires.
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
### Include guards
|
|
99
|
+
|
|
100
|
+
Before you are finished with the header file, you should add include guards.
|
|
101
|
+
Include guards are used to help prevent the file from being included multiple times by accident.
|
|
102
|
+
If the file _was_ included multiple times then the functions and other items would be declared twice; In C this is an error because the compiler thinks you are trying to declare another _different_ function that has the same name.
|
|
103
|
+
|
|
104
|
+
To add include guards, add something similar to the following as the first two lines of the header:
|
|
105
|
+
|
|
106
|
+
```c
|
|
107
|
+
#ifndef EXERCISE_NAME_H
|
|
108
|
+
#define EXERCISE_NAME_H
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
And on the very last line:
|
|
112
|
+
|
|
113
|
+
```c
|
|
114
|
+
#endif
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
### Add the required definitions
|
|
119
|
+
|
|
120
|
+
Once the header file is complete you may still have build errors similar to the following:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
Compiling tests.out
|
|
124
|
+
src/exercise_name.c:1:0: error: ISO C forbids an empty translation unit [-Werror=pedantic]
|
|
125
|
+
cc1: all warnings being treated as errors
|
|
126
|
+
makefile:24: recipe for target 'tests.out' failed
|
|
127
|
+
make: *** [tests.out] Error 1
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
This is because although you have _declared_ all the items you need to, they have not yet been _defined_.
|
|
131
|
+
To define the needed items you need to add their implementation to the `exercise_name.c` file.
|
|
132
|
+
For the function `foo()` from the previous example, this would look similar to:
|
|
133
|
+
|
|
134
|
+
```c
|
|
135
|
+
#include "exercise_name.h"
|
|
136
|
+
|
|
137
|
+
bar_t foo(struct baz b, double d)
|
|
138
|
+
{
|
|
139
|
+
// Your exercise code here
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
After having resolved these errors you should be ready to start making the tests pass!
|
|
144
|
+
|
|
145
|
+
|
|
21
146
|
## Getting Started
|
|
22
147
|
|
|
23
148
|
Make sure you have read the
|
|
@@ -5,23 +5,20 @@ if [[ ! -d "exercises" ]]; then
|
|
|
5
5
|
exit 1
|
|
6
6
|
fi
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
tar czf exercises.tgz exercises
|
|
9
|
+
pushd $_
|
|
9
10
|
|
|
11
|
+
err_cnt=0
|
|
10
12
|
for ex in *; do
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
cd $ex
|
|
14
|
-
mv $impl "${impl}.tmp"
|
|
15
|
-
cp example.el $impl
|
|
13
|
+
pushd $ex
|
|
14
|
+
mv example.el "${ex}.el"
|
|
16
15
|
emacs -batch -l ert -l "${ex}-test.el" -f ert-run-tests-batch-and-exit
|
|
17
16
|
let "err_cnt += $?"
|
|
18
|
-
|
|
19
|
-
cd -
|
|
17
|
+
popd
|
|
20
18
|
done
|
|
21
19
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
fi
|
|
20
|
+
popd
|
|
21
|
+
tar xzf exercises.tgz
|
|
22
|
+
rm $_
|
|
23
|
+
|
|
24
|
+
[ $err_cnt -eq 0 ] || exit 1
|
data/tracks/elisp/config.json
CHANGED
|
@@ -160,8 +160,16 @@
|
|
|
160
160
|
"topics": null,
|
|
161
161
|
"unlocked_by": null,
|
|
162
162
|
"uuid": "d219aab6-11ec-4e0c-b041-f06c8d523946"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"core": false,
|
|
166
|
+
"difficulty": 1,
|
|
167
|
+
"slug": "acronym",
|
|
168
|
+
"topics": null,
|
|
169
|
+
"unlocked_by": null,
|
|
170
|
+
"uuid": "a252e137-8a63-4f26-b119-7264f12a257a"
|
|
163
171
|
}
|
|
164
172
|
],
|
|
165
173
|
"foregone": [],
|
|
166
174
|
"language": "Emacs Lisp"
|
|
167
|
-
}
|
|
175
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Acronym
|
|
2
|
+
|
|
3
|
+
Convert a phrase to its acronym.
|
|
4
|
+
|
|
5
|
+
Techies love their TLA (Three Letter Acronyms)!
|
|
6
|
+
|
|
7
|
+
Help generate some jargon by writing a program that converts a long name like Portable Network Graphics to its acronym (PNG).
|
|
8
|
+
## Source
|
|
9
|
+
|
|
10
|
+
Julien Vanier https://github.com/monkbroc
|
|
11
|
+
|
|
12
|
+
## Submitting Incomplete Solutions
|
|
13
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
;;; acronym-test.el --- Tests for Acronym (exercism)
|
|
2
|
+
|
|
3
|
+
;;; Commentary:
|
|
4
|
+
|
|
5
|
+
;;; Code
|
|
6
|
+
|
|
7
|
+
(load-file "acronym.el")
|
|
8
|
+
|
|
9
|
+
(ert-deftest basic ()
|
|
10
|
+
(should (equal "PNG" (acronym "Portable Network Graphics"))))
|
|
11
|
+
|
|
12
|
+
(ert-deftest lowercase-words ()
|
|
13
|
+
(should (equal "ROR" (acronym "Ruby on Rails"))))
|
|
14
|
+
|
|
15
|
+
(ert-deftest punctuation ()
|
|
16
|
+
(should (equal "FIFO" (acronym "First In, First Out"))))
|
|
17
|
+
|
|
18
|
+
(ert-deftest all-caps-words ()
|
|
19
|
+
(should (equal "PHP" (acronym "PHP: Hypertext Preprocessor"))))
|
|
20
|
+
|
|
21
|
+
(ert-deftest non-acronym-all-caps-word ()
|
|
22
|
+
(should (equal "GIMP" (acronym "GNU Image Manipulation Program"))))
|
|
23
|
+
|
|
24
|
+
(ert-deftest hyphenated ()
|
|
25
|
+
(should (equal "CMOS" (acronym "Complementary metal-oxide semiconductor"))))
|
|
26
|
+
|
|
27
|
+
(provide 'acronym-test)
|
|
28
|
+
;;; acronym-test.el ends here
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
;;; acronym.el --- Acronym (exercism)
|
|
2
|
+
|
|
3
|
+
;;; Commentary:
|
|
4
|
+
|
|
5
|
+
;;; Code:
|
|
6
|
+
|
|
7
|
+
(require 'cl)
|
|
8
|
+
|
|
9
|
+
(defun acronym (input)
|
|
10
|
+
(let ((words (split-string input "\\W+")))
|
|
11
|
+
(mapconcat (lambda (word) (upcase (substring word 0 1))) words "")))
|
|
12
|
+
|
|
13
|
+
(provide 'acronym)
|
|
14
|
+
;;; acronym.el ends here
|
|
@@ -3,12 +3,10 @@
|
|
|
3
3
|
;;; Commentary:
|
|
4
4
|
|
|
5
5
|
;;; Code:
|
|
6
|
-
(eval-when-compile (require 'subr-x))
|
|
7
|
-
|
|
8
6
|
(defun response-for (phrase)
|
|
9
7
|
"Provides Bob's response to PHRASE."
|
|
10
8
|
(cond ((shoutp phrase) "Whoa, chill out!")
|
|
11
|
-
((string-
|
|
9
|
+
((string-match-p "^[[:space:]]*$" phrase) "Fine. Be that way!")
|
|
12
10
|
((questionp phrase) "Sure.")
|
|
13
11
|
(t "Whatever.")))
|
|
14
12
|
|
|
@@ -34,9 +34,11 @@ The Hamming distance between these two DNA strands is 7.
|
|
|
34
34
|
The Hamming distance is only defined for sequences of equal length. This means
|
|
35
35
|
that based on the definition, each language could deal with getting sequences
|
|
36
36
|
of equal length differently.
|
|
37
|
+
|
|
37
38
|
## Source
|
|
38
39
|
|
|
39
40
|
The Calculating Point Mutations problem at Rosalind [http://rosalind.info/problems/hamm/](http://rosalind.info/problems/hamm/)
|
|
40
41
|
|
|
41
42
|
## Submitting Incomplete Solutions
|
|
43
|
+
|
|
42
44
|
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
|
@@ -1,32 +1,55 @@
|
|
|
1
1
|
;;; hamming-test.el --- Tests for hamming (exercism)
|
|
2
2
|
|
|
3
3
|
;;; Commentary:
|
|
4
|
+
;; Common test data version: 2.0.1 f79dfd7
|
|
4
5
|
|
|
5
6
|
;;; Code:
|
|
6
7
|
|
|
7
8
|
(load-file "hamming.el")
|
|
8
9
|
|
|
9
|
-
(
|
|
10
|
+
(declare-function hamming-distance "hamming.el")
|
|
11
|
+
|
|
12
|
+
(ert-deftest empty-strands ()
|
|
10
13
|
(should (= 0 (hamming-distance "" ""))))
|
|
11
14
|
|
|
12
|
-
(ert-deftest
|
|
13
|
-
(should (= 0 (hamming-distance "
|
|
15
|
+
(ert-deftest identical-strands ()
|
|
16
|
+
(should (= 0 (hamming-distance "A" "A"))))
|
|
17
|
+
|
|
18
|
+
(ert-deftest long-identical-strands ()
|
|
19
|
+
(should (= 0 (hamming-distance "GGACTGA" "GGACTGA"))))
|
|
20
|
+
|
|
21
|
+
(ert-deftest complete-distance-in-single-nucleotide-strands ()
|
|
22
|
+
(should (= 1 (hamming-distance "A" "G"))))
|
|
23
|
+
|
|
24
|
+
(ert-deftest complete-distance-in-small-strands ()
|
|
25
|
+
(should (= 2 (hamming-distance "AG" "CT"))))
|
|
14
26
|
|
|
15
|
-
(ert-deftest
|
|
16
|
-
(should (=
|
|
27
|
+
(ert-deftest small-distance-in-small-strands ()
|
|
28
|
+
(should (= 1 (hamming-distance "AT" "CT"))))
|
|
17
29
|
|
|
18
|
-
(ert-deftest small-
|
|
30
|
+
(ert-deftest small-distance ()
|
|
19
31
|
(should (= 1 (hamming-distance "GGACG" "GGTCG"))))
|
|
20
32
|
|
|
21
|
-
(ert-deftest
|
|
33
|
+
(ert-deftest small-distance-in-long-strands ()
|
|
22
34
|
(should (= 2 (hamming-distance "ACCAGGG" "ACTATGG"))))
|
|
23
35
|
|
|
24
|
-
(ert-deftest
|
|
25
|
-
(should
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
(should
|
|
36
|
+
(ert-deftest non-unique-character-in-first-strand ()
|
|
37
|
+
(should (= 1 (hamming-distance "AAA" "AAG"))))
|
|
38
|
+
|
|
39
|
+
(ert-deftest same-nucleotides-in-different-positions ()
|
|
40
|
+
(should (= 2 (hamming-distance "TAG" "GAT"))))
|
|
41
|
+
|
|
42
|
+
(ert-deftest large-distance ()
|
|
43
|
+
(should (= 4 (hamming-distance "GATACA" "GCATAA"))))
|
|
44
|
+
|
|
45
|
+
(ert-deftest large-distance-in-off-by-one-strand ()
|
|
46
|
+
(should (= 9 (hamming-distance "GGACGGATTCTG" "AGGACGGATTCT"))))
|
|
47
|
+
|
|
48
|
+
(ert-deftest disallow-first-strand-longer ()
|
|
49
|
+
(should-error (hamming-distance "AATG" "AAA")))
|
|
29
50
|
|
|
51
|
+
(ert-deftest disallow-first-strand-longer ()
|
|
52
|
+
(should-error (hamming-distance "ATA" "AGTG")))
|
|
30
53
|
|
|
31
54
|
(provide 'hamming-test)
|
|
32
55
|
;;; hamming-test.el ends here
|
|
@@ -1,229 +1,303 @@
|
|
|
1
|
+
// This file was auto-generated based on version 1.1.0 of the canonical data.
|
|
2
|
+
|
|
1
3
|
module CustomSetTest
|
|
2
4
|
|
|
3
|
-
open Xunit
|
|
4
5
|
open FsUnit.Xunit
|
|
6
|
+
open Xunit
|
|
5
7
|
|
|
6
8
|
open CustomSet
|
|
7
9
|
|
|
8
10
|
[<Fact>]
|
|
9
11
|
let ``Sets with no elements are empty`` () =
|
|
10
|
-
let actual =
|
|
11
|
-
|
|
12
|
+
let actual = CustomSet.isEmpty (CustomSet.fromList [])
|
|
13
|
+
actual |> should equal true
|
|
12
14
|
|
|
13
15
|
[<Fact(Skip = "Remove to run test")>]
|
|
14
16
|
let ``Sets with elements are not empty`` () =
|
|
15
|
-
let actual =
|
|
16
|
-
|
|
17
|
+
let actual = CustomSet.isEmpty (CustomSet.fromList [1])
|
|
18
|
+
actual |> should equal false
|
|
17
19
|
|
|
18
20
|
[<Fact(Skip = "Remove to run test")>]
|
|
19
21
|
let ``Nothing is contained in an empty set`` () =
|
|
20
|
-
let
|
|
21
|
-
|
|
22
|
+
let setValue = CustomSet.fromList []
|
|
23
|
+
let element = 1
|
|
24
|
+
let actual = CustomSet.contains element setValue
|
|
25
|
+
actual |> should equal false
|
|
22
26
|
|
|
23
27
|
[<Fact(Skip = "Remove to run test")>]
|
|
24
|
-
let ``
|
|
25
|
-
let
|
|
26
|
-
|
|
28
|
+
let ``When the element is in the set`` () =
|
|
29
|
+
let setValue = CustomSet.fromList [1; 2; 3]
|
|
30
|
+
let element = 1
|
|
31
|
+
let actual = CustomSet.contains element setValue
|
|
32
|
+
actual |> should equal true
|
|
27
33
|
|
|
28
34
|
[<Fact(Skip = "Remove to run test")>]
|
|
29
|
-
let ``
|
|
30
|
-
let
|
|
31
|
-
|
|
32
|
-
|
|
35
|
+
let ``When the element is not in the set`` () =
|
|
36
|
+
let setValue = CustomSet.fromList [1; 2; 3]
|
|
37
|
+
let element = 4
|
|
38
|
+
let actual = CustomSet.contains element setValue
|
|
39
|
+
actual |> should equal false
|
|
40
|
+
|
|
33
41
|
[<Fact(Skip = "Remove to run test")>]
|
|
34
42
|
let ``Empty set is a subset of another empty set`` () =
|
|
35
|
-
let
|
|
36
|
-
let
|
|
37
|
-
|
|
38
|
-
|
|
43
|
+
let set1 = CustomSet.fromList []
|
|
44
|
+
let set2 = CustomSet.fromList []
|
|
45
|
+
let actual = CustomSet.isSubsetOf set1 set2
|
|
46
|
+
actual |> should equal true
|
|
47
|
+
|
|
39
48
|
[<Fact(Skip = "Remove to run test")>]
|
|
40
49
|
let ``Empty set is a subset of non-empty set`` () =
|
|
41
|
-
let
|
|
42
|
-
let
|
|
43
|
-
|
|
44
|
-
|
|
50
|
+
let set1 = CustomSet.fromList []
|
|
51
|
+
let set2 = CustomSet.fromList [1]
|
|
52
|
+
let actual = CustomSet.isSubsetOf set1 set2
|
|
53
|
+
actual |> should equal true
|
|
54
|
+
|
|
45
55
|
[<Fact(Skip = "Remove to run test")>]
|
|
46
56
|
let ``Non-empty set is not a subset of empty set`` () =
|
|
47
|
-
let
|
|
48
|
-
let
|
|
49
|
-
|
|
50
|
-
|
|
57
|
+
let set1 = CustomSet.fromList [1]
|
|
58
|
+
let set2 = CustomSet.fromList []
|
|
59
|
+
let actual = CustomSet.isSubsetOf set1 set2
|
|
60
|
+
actual |> should equal false
|
|
61
|
+
|
|
51
62
|
[<Fact(Skip = "Remove to run test")>]
|
|
52
63
|
let ``Set is a subset of set with exact same elements`` () =
|
|
53
|
-
let
|
|
54
|
-
let
|
|
55
|
-
|
|
56
|
-
|
|
64
|
+
let set1 = CustomSet.fromList [1; 2; 3]
|
|
65
|
+
let set2 = CustomSet.fromList [1; 2; 3]
|
|
66
|
+
let actual = CustomSet.isSubsetOf set1 set2
|
|
67
|
+
actual |> should equal true
|
|
68
|
+
|
|
57
69
|
[<Fact(Skip = "Remove to run test")>]
|
|
58
70
|
let ``Set is a subset of larger set with same elements`` () =
|
|
59
|
-
let
|
|
60
|
-
let
|
|
61
|
-
|
|
62
|
-
|
|
71
|
+
let set1 = CustomSet.fromList [1; 2; 3]
|
|
72
|
+
let set2 = CustomSet.fromList [4; 1; 2; 3]
|
|
73
|
+
let actual = CustomSet.isSubsetOf set1 set2
|
|
74
|
+
actual |> should equal true
|
|
75
|
+
|
|
63
76
|
[<Fact(Skip = "Remove to run test")>]
|
|
64
77
|
let ``Set is not a subset of set that does not contain its elements`` () =
|
|
65
|
-
let
|
|
66
|
-
let
|
|
67
|
-
|
|
68
|
-
|
|
78
|
+
let set1 = CustomSet.fromList [1; 2; 3]
|
|
79
|
+
let set2 = CustomSet.fromList [4; 1; 3]
|
|
80
|
+
let actual = CustomSet.isSubsetOf set1 set2
|
|
81
|
+
actual |> should equal false
|
|
82
|
+
|
|
69
83
|
[<Fact(Skip = "Remove to run test")>]
|
|
70
84
|
let ``The empty set is disjoint with itself`` () =
|
|
71
|
-
let
|
|
72
|
-
let
|
|
73
|
-
|
|
74
|
-
|
|
85
|
+
let set1 = CustomSet.fromList []
|
|
86
|
+
let set2 = CustomSet.fromList []
|
|
87
|
+
let actual = CustomSet.isDisjointFrom set1 set2
|
|
88
|
+
actual |> should equal true
|
|
89
|
+
|
|
75
90
|
[<Fact(Skip = "Remove to run test")>]
|
|
76
91
|
let ``Empty set is disjoint with non-empty set`` () =
|
|
77
|
-
let
|
|
78
|
-
let
|
|
79
|
-
|
|
80
|
-
|
|
92
|
+
let set1 = CustomSet.fromList []
|
|
93
|
+
let set2 = CustomSet.fromList [1]
|
|
94
|
+
let actual = CustomSet.isDisjointFrom set1 set2
|
|
95
|
+
actual |> should equal true
|
|
96
|
+
|
|
81
97
|
[<Fact(Skip = "Remove to run test")>]
|
|
82
98
|
let ``Non-empty set is disjoint with empty set`` () =
|
|
83
|
-
let
|
|
84
|
-
let
|
|
85
|
-
|
|
86
|
-
|
|
99
|
+
let set1 = CustomSet.fromList [1]
|
|
100
|
+
let set2 = CustomSet.fromList []
|
|
101
|
+
let actual = CustomSet.isDisjointFrom set1 set2
|
|
102
|
+
actual |> should equal true
|
|
103
|
+
|
|
87
104
|
[<Fact(Skip = "Remove to run test")>]
|
|
88
105
|
let ``Sets are not disjoint if they share an element`` () =
|
|
89
|
-
let
|
|
90
|
-
let
|
|
91
|
-
|
|
92
|
-
|
|
106
|
+
let set1 = CustomSet.fromList [1; 2]
|
|
107
|
+
let set2 = CustomSet.fromList [2; 3]
|
|
108
|
+
let actual = CustomSet.isDisjointFrom set1 set2
|
|
109
|
+
actual |> should equal false
|
|
110
|
+
|
|
93
111
|
[<Fact(Skip = "Remove to run test")>]
|
|
94
112
|
let ``Sets are disjoint if they share no elements`` () =
|
|
95
|
-
let
|
|
96
|
-
let
|
|
97
|
-
|
|
113
|
+
let set1 = CustomSet.fromList [1; 2]
|
|
114
|
+
let set2 = CustomSet.fromList [3; 4]
|
|
115
|
+
let actual = CustomSet.isDisjointFrom set1 set2
|
|
116
|
+
actual |> should equal true
|
|
98
117
|
|
|
99
118
|
[<Fact(Skip = "Remove to run test")>]
|
|
100
119
|
let ``Empty sets are equal`` () =
|
|
101
|
-
let
|
|
102
|
-
let
|
|
103
|
-
|
|
120
|
+
let set1 = CustomSet.fromList []
|
|
121
|
+
let set2 = CustomSet.fromList []
|
|
122
|
+
let actual = CustomSet.isEqualTo set1 set2
|
|
123
|
+
actual |> should equal true
|
|
104
124
|
|
|
105
125
|
[<Fact(Skip = "Remove to run test")>]
|
|
106
126
|
let ``Empty set is not equal to non-empty set`` () =
|
|
107
|
-
let
|
|
108
|
-
let
|
|
109
|
-
|
|
127
|
+
let set1 = CustomSet.fromList []
|
|
128
|
+
let set2 = CustomSet.fromList [1; 2; 3]
|
|
129
|
+
let actual = CustomSet.isEqualTo set1 set2
|
|
130
|
+
actual |> should equal false
|
|
110
131
|
|
|
111
132
|
[<Fact(Skip = "Remove to run test")>]
|
|
112
133
|
let ``Non-empty set is not equal to empty set`` () =
|
|
113
|
-
let
|
|
114
|
-
let
|
|
115
|
-
|
|
134
|
+
let set1 = CustomSet.fromList [1; 2; 3]
|
|
135
|
+
let set2 = CustomSet.fromList []
|
|
136
|
+
let actual = CustomSet.isEqualTo set1 set2
|
|
137
|
+
actual |> should equal false
|
|
116
138
|
|
|
117
139
|
[<Fact(Skip = "Remove to run test")>]
|
|
118
140
|
let ``Sets with the same elements are equal`` () =
|
|
119
|
-
let
|
|
120
|
-
let
|
|
121
|
-
|
|
141
|
+
let set1 = CustomSet.fromList [1; 2]
|
|
142
|
+
let set2 = CustomSet.fromList [2; 1]
|
|
143
|
+
let actual = CustomSet.isEqualTo set1 set2
|
|
144
|
+
actual |> should equal true
|
|
122
145
|
|
|
123
146
|
[<Fact(Skip = "Remove to run test")>]
|
|
124
147
|
let ``Sets with different elements are not equal`` () =
|
|
125
|
-
let
|
|
126
|
-
let
|
|
127
|
-
|
|
148
|
+
let set1 = CustomSet.fromList [1; 2; 3]
|
|
149
|
+
let set2 = CustomSet.fromList [1; 2; 4]
|
|
150
|
+
let actual = CustomSet.isEqualTo set1 set2
|
|
151
|
+
actual |> should equal false
|
|
152
|
+
|
|
153
|
+
[<Fact(Skip = "Remove to run test")>]
|
|
154
|
+
let ``Set is not equal to larger set with same elements`` () =
|
|
155
|
+
let set1 = CustomSet.fromList [1; 2; 3]
|
|
156
|
+
let set2 = CustomSet.fromList [1; 2; 3; 4]
|
|
157
|
+
let actual = CustomSet.isEqualTo set1 set2
|
|
158
|
+
actual |> should equal false
|
|
128
159
|
|
|
129
160
|
[<Fact(Skip = "Remove to run test")>]
|
|
130
161
|
let ``Add to empty set`` () =
|
|
131
|
-
let
|
|
132
|
-
let
|
|
133
|
-
actual
|
|
162
|
+
let setValue = CustomSet.fromList []
|
|
163
|
+
let element = 3
|
|
164
|
+
let actual = CustomSet.insert element setValue
|
|
165
|
+
let expectedSet = CustomSet.fromList [3]
|
|
166
|
+
let actualBool = CustomSet.isEqualTo actual expectedSet
|
|
167
|
+
actualBool |> should equal true
|
|
134
168
|
|
|
135
169
|
[<Fact(Skip = "Remove to run test")>]
|
|
136
170
|
let ``Add to non-empty set`` () =
|
|
137
|
-
let
|
|
138
|
-
let
|
|
139
|
-
actual
|
|
171
|
+
let setValue = CustomSet.fromList [1; 2; 4]
|
|
172
|
+
let element = 3
|
|
173
|
+
let actual = CustomSet.insert element setValue
|
|
174
|
+
let expectedSet = CustomSet.fromList [1; 2; 3; 4]
|
|
175
|
+
let actualBool = CustomSet.isEqualTo actual expectedSet
|
|
176
|
+
actualBool |> should equal true
|
|
140
177
|
|
|
141
178
|
[<Fact(Skip = "Remove to run test")>]
|
|
142
179
|
let ``Adding an existing element does not change the set`` () =
|
|
143
|
-
let
|
|
144
|
-
let
|
|
145
|
-
actual
|
|
146
|
-
|
|
180
|
+
let setValue = CustomSet.fromList [1; 2; 3]
|
|
181
|
+
let element = 3
|
|
182
|
+
let actual = CustomSet.insert element setValue
|
|
183
|
+
let expectedSet = CustomSet.fromList [1; 2; 3]
|
|
184
|
+
let actualBool = CustomSet.isEqualTo actual expectedSet
|
|
185
|
+
actualBool |> should equal true
|
|
186
|
+
|
|
147
187
|
[<Fact(Skip = "Remove to run test")>]
|
|
148
188
|
let ``Intersection of two empty sets is an empty set`` () =
|
|
149
|
-
let
|
|
150
|
-
let
|
|
151
|
-
|
|
189
|
+
let set1 = CustomSet.fromList []
|
|
190
|
+
let set2 = CustomSet.fromList []
|
|
191
|
+
let actual = CustomSet.intersection set1 set2
|
|
192
|
+
let expectedSet = CustomSet.fromList []
|
|
193
|
+
let actualBool = CustomSet.isEqualTo actual expectedSet
|
|
194
|
+
actualBool |> should equal true
|
|
152
195
|
|
|
153
196
|
[<Fact(Skip = "Remove to run test")>]
|
|
154
197
|
let ``Intersection of an empty set and non-empty set is an empty set`` () =
|
|
155
|
-
let
|
|
156
|
-
let
|
|
157
|
-
|
|
198
|
+
let set1 = CustomSet.fromList []
|
|
199
|
+
let set2 = CustomSet.fromList [3; 2; 5]
|
|
200
|
+
let actual = CustomSet.intersection set1 set2
|
|
201
|
+
let expectedSet = CustomSet.fromList []
|
|
202
|
+
let actualBool = CustomSet.isEqualTo actual expectedSet
|
|
203
|
+
actualBool |> should equal true
|
|
158
204
|
|
|
159
205
|
[<Fact(Skip = "Remove to run test")>]
|
|
160
206
|
let ``Intersection of a non-empty set and an empty set is an empty set`` () =
|
|
161
|
-
let
|
|
162
|
-
let
|
|
163
|
-
|
|
207
|
+
let set1 = CustomSet.fromList [1; 2; 3; 4]
|
|
208
|
+
let set2 = CustomSet.fromList []
|
|
209
|
+
let actual = CustomSet.intersection set1 set2
|
|
210
|
+
let expectedSet = CustomSet.fromList []
|
|
211
|
+
let actualBool = CustomSet.isEqualTo actual expectedSet
|
|
212
|
+
actualBool |> should equal true
|
|
164
213
|
|
|
165
214
|
[<Fact(Skip = "Remove to run test")>]
|
|
166
215
|
let ``Intersection of two sets with no shared elements is an empty set`` () =
|
|
167
|
-
let
|
|
168
|
-
let
|
|
169
|
-
|
|
216
|
+
let set1 = CustomSet.fromList [1; 2; 3]
|
|
217
|
+
let set2 = CustomSet.fromList [4; 5; 6]
|
|
218
|
+
let actual = CustomSet.intersection set1 set2
|
|
219
|
+
let expectedSet = CustomSet.fromList []
|
|
220
|
+
let actualBool = CustomSet.isEqualTo actual expectedSet
|
|
221
|
+
actualBool |> should equal true
|
|
170
222
|
|
|
171
223
|
[<Fact(Skip = "Remove to run test")>]
|
|
172
224
|
let ``Intersection of two sets with shared elements is a set of the shared elements`` () =
|
|
173
|
-
let
|
|
174
|
-
let
|
|
175
|
-
let
|
|
176
|
-
|
|
177
|
-
|
|
225
|
+
let set1 = CustomSet.fromList [1; 2; 3; 4]
|
|
226
|
+
let set2 = CustomSet.fromList [3; 2; 5]
|
|
227
|
+
let actual = CustomSet.intersection set1 set2
|
|
228
|
+
let expectedSet = CustomSet.fromList [2; 3]
|
|
229
|
+
let actualBool = CustomSet.isEqualTo actual expectedSet
|
|
230
|
+
actualBool |> should equal true
|
|
231
|
+
|
|
178
232
|
[<Fact(Skip = "Remove to run test")>]
|
|
179
233
|
let ``Difference of two empty sets is an empty set`` () =
|
|
180
|
-
let
|
|
181
|
-
let
|
|
182
|
-
|
|
234
|
+
let set1 = CustomSet.fromList []
|
|
235
|
+
let set2 = CustomSet.fromList []
|
|
236
|
+
let actual = CustomSet.difference set1 set2
|
|
237
|
+
let expectedSet = CustomSet.fromList []
|
|
238
|
+
let actualBool = CustomSet.isEqualTo actual expectedSet
|
|
239
|
+
actualBool |> should equal true
|
|
183
240
|
|
|
184
241
|
[<Fact(Skip = "Remove to run test")>]
|
|
185
|
-
let ``Difference of
|
|
186
|
-
let
|
|
187
|
-
let
|
|
188
|
-
|
|
242
|
+
let ``Difference of empty set and non-empty set is an empty set`` () =
|
|
243
|
+
let set1 = CustomSet.fromList []
|
|
244
|
+
let set2 = CustomSet.fromList [3; 2; 5]
|
|
245
|
+
let actual = CustomSet.difference set1 set2
|
|
246
|
+
let expectedSet = CustomSet.fromList []
|
|
247
|
+
let actualBool = CustomSet.isEqualTo actual expectedSet
|
|
248
|
+
actualBool |> should equal true
|
|
189
249
|
|
|
190
250
|
[<Fact(Skip = "Remove to run test")>]
|
|
191
|
-
let ``Difference of a non-empty set and an empty set is
|
|
192
|
-
let
|
|
193
|
-
let
|
|
194
|
-
let
|
|
195
|
-
|
|
251
|
+
let ``Difference of a non-empty set and an empty set is the non-empty set`` () =
|
|
252
|
+
let set1 = CustomSet.fromList [1; 2; 3; 4]
|
|
253
|
+
let set2 = CustomSet.fromList []
|
|
254
|
+
let actual = CustomSet.difference set1 set2
|
|
255
|
+
let expectedSet = CustomSet.fromList [1; 2; 3; 4]
|
|
256
|
+
let actualBool = CustomSet.isEqualTo actual expectedSet
|
|
257
|
+
actualBool |> should equal true
|
|
196
258
|
|
|
197
259
|
[<Fact(Skip = "Remove to run test")>]
|
|
198
260
|
let ``Difference of two non-empty sets is a set of elements that are only in the first set`` () =
|
|
199
|
-
let
|
|
200
|
-
let
|
|
201
|
-
let
|
|
202
|
-
|
|
203
|
-
|
|
261
|
+
let set1 = CustomSet.fromList [3; 2; 1]
|
|
262
|
+
let set2 = CustomSet.fromList [2; 4]
|
|
263
|
+
let actual = CustomSet.difference set1 set2
|
|
264
|
+
let expectedSet = CustomSet.fromList [1; 3]
|
|
265
|
+
let actualBool = CustomSet.isEqualTo actual expectedSet
|
|
266
|
+
actualBool |> should equal true
|
|
267
|
+
|
|
204
268
|
[<Fact(Skip = "Remove to run test")>]
|
|
205
|
-
let ``Union of
|
|
206
|
-
let
|
|
207
|
-
let
|
|
208
|
-
|
|
269
|
+
let ``Union of empty sets is an empty set`` () =
|
|
270
|
+
let set1 = CustomSet.fromList []
|
|
271
|
+
let set2 = CustomSet.fromList []
|
|
272
|
+
let actual = CustomSet.union set1 set2
|
|
273
|
+
let expectedSet = CustomSet.fromList []
|
|
274
|
+
let actualBool = CustomSet.isEqualTo actual expectedSet
|
|
275
|
+
actualBool |> should equal true
|
|
209
276
|
|
|
210
277
|
[<Fact(Skip = "Remove to run test")>]
|
|
211
278
|
let ``Union of an empty set and non-empty set is the non-empty set`` () =
|
|
212
|
-
let
|
|
213
|
-
let
|
|
214
|
-
let
|
|
215
|
-
|
|
279
|
+
let set1 = CustomSet.fromList []
|
|
280
|
+
let set2 = CustomSet.fromList [2]
|
|
281
|
+
let actual = CustomSet.union set1 set2
|
|
282
|
+
let expectedSet = CustomSet.fromList [2]
|
|
283
|
+
let actualBool = CustomSet.isEqualTo actual expectedSet
|
|
284
|
+
actualBool |> should equal true
|
|
216
285
|
|
|
217
286
|
[<Fact(Skip = "Remove to run test")>]
|
|
218
287
|
let ``Union of a non-empty set and empty set is the non-empty set`` () =
|
|
219
|
-
let
|
|
220
|
-
let
|
|
221
|
-
let
|
|
222
|
-
|
|
288
|
+
let set1 = CustomSet.fromList [1; 3]
|
|
289
|
+
let set2 = CustomSet.fromList []
|
|
290
|
+
let actual = CustomSet.union set1 set2
|
|
291
|
+
let expectedSet = CustomSet.fromList [1; 3]
|
|
292
|
+
let actualBool = CustomSet.isEqualTo actual expectedSet
|
|
293
|
+
actualBool |> should equal true
|
|
223
294
|
|
|
224
295
|
[<Fact(Skip = "Remove to run test")>]
|
|
225
296
|
let ``Union of non-empty sets contains all unique elements`` () =
|
|
226
|
-
let
|
|
227
|
-
let
|
|
228
|
-
let
|
|
229
|
-
|
|
297
|
+
let set1 = CustomSet.fromList [1; 3]
|
|
298
|
+
let set2 = CustomSet.fromList [2; 3]
|
|
299
|
+
let actual = CustomSet.union set1 set2
|
|
300
|
+
let expectedSet = CustomSet.fromList [3; 2; 1]
|
|
301
|
+
let actualBool = CustomSet.isEqualTo actual expectedSet
|
|
302
|
+
actualBool |> should equal true
|
|
303
|
+
|