trackler 2.2.1.155 → 2.2.1.156
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitmodules +3 -0
- data/lib/trackler/version.rb +1 -1
- data/problem-specifications/exercises/simple-cipher/canonical-data.json +147 -0
- data/tracks/clojure/exercises/hexadecimal/src/hexadecimal.clj +5 -0
- data/tracks/clojure/exercises/isogram/src/isogram.clj +5 -0
- data/tracks/clojure/exercises/kindergarten-garden/src/kindergarten-garden.clj +5 -0
- data/tracks/csharp/exercises/list-ops/Example.cs +14 -9
- data/tracks/csharp/exercises/list-ops/ListOps.cs +4 -4
- data/tracks/csharp/exercises/list-ops/ListOpsTest.cs +90 -88
- data/tracks/csharp/exercises/zipper/Example.cs +51 -43
- data/tracks/csharp/exercises/zipper/Zipper.cs +16 -19
- data/tracks/csharp/exercises/zipper/ZipperTest.cs +94 -45
- data/tracks/csharp/generators/Exercises/ListOps.cs +123 -0
- data/tracks/csharp/generators/Exercises/Zipper.cs +107 -0
- data/tracks/csharp/generators/Output/ValueFormatter.cs +14 -0
- data/tracks/delphi/config.json +10 -1
- data/tracks/delphi/config/maintainers.json +11 -11
- data/tracks/elisp/config.json +8 -0
- data/tracks/elisp/exercises/run-length-encoding/README.md +36 -0
- data/tracks/elisp/exercises/run-length-encoding/example.el +62 -0
- data/tracks/elisp/exercises/run-length-encoding/run-length-encoding-test.el +61 -0
- data/tracks/elisp/exercises/run-length-encoding/run-length-encoding.el +9 -0
- data/tracks/fsharp/docs/LEARNING.md +3 -0
- data/tracks/java/exercises/armstrong-numbers/.meta/hints.md +2 -0
- data/tracks/java/exercises/armstrong-numbers/README.md +6 -0
- data/tracks/java/exercises/bracket-push/.meta/version +1 -1
- data/tracks/java/exercises/bracket-push/src/test/java/BracketCheckerTest.java +7 -0
- data/tracks/java/exercises/isbn-verifier/.meta/version +1 -1
- data/tracks/java/exercises/isbn-verifier/src/test/java/IsbnVerifierTest.java +12 -1
- data/tracks/java/exercises/kindergarten-garden/.meta/version +1 -1
- data/tracks/java/exercises/list-ops/.meta/version +1 -1
- data/tracks/java/exercises/list-ops/src/test/java/ListOpsTest.java +32 -1
- data/tracks/nim/config.json +13 -2
- data/tracks/nim/exercises/bob/bob_test.nim +1 -1
- data/tracks/nim/exercises/bob/example.nim +6 -3
- data/tracks/nim/exercises/bracket-push/README.md +11 -0
- data/tracks/nim/exercises/bracket-push/bracket_push_test.nim +52 -0
- data/tracks/nim/exercises/bracket-push/example.nim +22 -0
- data/tracks/ocaml/exercises/bracket-push/test.ml +3 -1
- data/tracks/ocaml/exercises/luhn/example.ml +8 -5
- data/tracks/ocaml/exercises/luhn/test.ml +3 -1
- data/tracks/powershell/.gitignore +2 -1
- data/tracks/powershell/config.json +46 -13
- data/tracks/powershell/exercises/bob/.version +1 -0
- data/tracks/powershell/exercises/bob/BobResponse.example.ps1 +28 -0
- data/tracks/powershell/exercises/bob/BobResponse.ps1 +8 -0
- data/tracks/powershell/exercises/bob/BobResponse.tests.ps1 +109 -0
- data/tracks/powershell/exercises/bob/README.md +20 -0
- data/tracks/powershell/exercises/nucleotide-count/.version +1 -0
- data/tracks/powershell/exercises/nucleotide-count/NucleotideCount.example.ps1 +36 -0
- data/tracks/powershell/exercises/nucleotide-count/NucleotideCount.ps1 +8 -0
- data/tracks/powershell/exercises/nucleotide-count/NucleotideCount.tests.ps1 +25 -0
- data/tracks/powershell/exercises/nucleotide-count/README.md +19 -0
- data/tracks/powershell/exercises/raindrops/.version +1 -0
- data/tracks/powershell/exercises/raindrops/README.md +24 -0
- data/tracks/powershell/exercises/raindrops/Raindrops.example.ps1 +32 -0
- data/tracks/powershell/exercises/raindrops/Raindrops.ps1 +8 -0
- data/tracks/powershell/exercises/raindrops/Raindrops.tests.ps1 +34 -0
- data/tracks/prolog/exercises/complex-numbers/complex_numbers_tests.plt +28 -29
- data/tracks/reasonml/.gitignore +4 -0
- data/tracks/reasonml/.travis.yml +5 -0
- data/tracks/reasonml/LICENSE +21 -0
- data/tracks/reasonml/README.md +67 -0
- data/tracks/reasonml/bin/fetch-configlet +32 -0
- data/tracks/reasonml/config.json +11 -0
- data/tracks/reasonml/config/exercise-readme-insert.md +0 -0
- data/tracks/reasonml/config/exercise_readme.go.tmpl +16 -0
- data/tracks/reasonml/config/maintainers.json +4 -0
- data/tracks/reasonml/docs/ABOUT.md +0 -0
- data/tracks/reasonml/docs/INSTALLATION.md +0 -0
- data/tracks/reasonml/docs/LEARNING.md +0 -0
- data/tracks/reasonml/docs/RESOURCES.md +0 -0
- data/tracks/reasonml/docs/TESTS.md +0 -0
- data/tracks/reasonml/img/.keep +0 -0
- data/tracks/scala/config.json +11 -0
- data/tracks/scala/exercises/armstrong-numbers/README.md +29 -0
- data/tracks/scala/exercises/armstrong-numbers/build.sbt +3 -0
- data/tracks/scala/exercises/armstrong-numbers/example.scala +7 -0
- data/tracks/scala/exercises/armstrong-numbers/src/main/scala/.keep +0 -0
- data/tracks/scala/exercises/armstrong-numbers/src/test/scala/ArmstrongNumbersTest.scala +44 -0
- data/tracks/scala/testgen/src/main/scala/ArmstrongNumbersTestGenerator.scala +33 -0
- data/tracks/scheme/config.json +8 -0
- data/tracks/scheme/exercises/atbash-cipher/README.md +36 -0
- data/tracks/scheme/exercises/atbash-cipher/atbash-cipher-test.scm +67 -0
- data/tracks/scheme/exercises/atbash-cipher/atbash-cipher.scm +8 -0
- data/tracks/scheme/exercises/atbash-cipher/example.scm +40 -0
- metadata +57 -3
- data/tracks/python/exercises/rna-transcription/.meta/hints.md +0 -1
@@ -0,0 +1,109 @@
|
|
1
|
+
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
|
2
|
+
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.tests\.', '.'
|
3
|
+
. "$here\$sut"
|
4
|
+
|
5
|
+
Describe "Test Get-BobResponse" {
|
6
|
+
|
7
|
+
It "stating something" {
|
8
|
+
Get-BobResponse -HeyBob "Tom-ay-to, tom-aaaah-to." | Should -BeExactly "Whatever."
|
9
|
+
}
|
10
|
+
|
11
|
+
It "shouting" {
|
12
|
+
Get-BobResponse -HeyBob "WATCH OUT!" | Should -BeExactly "Whoa, chill out!"
|
13
|
+
}
|
14
|
+
|
15
|
+
It "shouting gibberish" {
|
16
|
+
Get-BobResponse -HeyBob "FCECDFCAAB" | Should -BeExactly "Whoa, chill out!"
|
17
|
+
}
|
18
|
+
|
19
|
+
It "asking a question" {
|
20
|
+
Get-BobResponse -HeyBob "Does this cryogenic chamber make me look fat?" | Should -BeExactly "Sure."
|
21
|
+
}
|
22
|
+
|
23
|
+
It "asking a numeric question" {
|
24
|
+
Get-BobResponse -HeyBob "You are, what, like 15?" | Should -BeExactly "Sure."
|
25
|
+
}
|
26
|
+
|
27
|
+
It "asking gibberish" {
|
28
|
+
Get-BobResponse -HeyBob "fffbbcbeab?" | Should -BeExactly "Sure."
|
29
|
+
}
|
30
|
+
|
31
|
+
It "talking forcefully" {
|
32
|
+
Get-BobResponse -HeyBob "Let's go make out behind the gym!" | Should -BeExactly "Whatever."
|
33
|
+
}
|
34
|
+
|
35
|
+
It "using acronyms in regular speech" {
|
36
|
+
Get-BobResponse -HeyBob "It's OK if you don't want to go to the DMV." | Should -BeExactly "Whatever."
|
37
|
+
}
|
38
|
+
|
39
|
+
It "forceful question" {
|
40
|
+
Get-BobResponse -HeyBob "WHAT THE HELL WERE YOU THINKING?" | Should -BeExactly "Calm down, I know what I'm doing!"
|
41
|
+
}
|
42
|
+
|
43
|
+
It "shouting numbers" {
|
44
|
+
Get-BobResponse -HeyBob "1, 2, 3 GO!" | Should -BeExactly "Whoa, chill out!"
|
45
|
+
}
|
46
|
+
|
47
|
+
It "only numbers" {
|
48
|
+
Get-BobResponse -HeyBob "1, 2, 3" | Should -BeExactly "Whatever."
|
49
|
+
}
|
50
|
+
|
51
|
+
It "question with only numbers" {
|
52
|
+
Get-BobResponse -HeyBob "4?" | Should -BeExactly "Sure."
|
53
|
+
}
|
54
|
+
|
55
|
+
It "shouting with special characters" {
|
56
|
+
Get-BobResponse -HeyBob "ZOMG THE %^*@#`$(*^ ZOMBIES ARE COMING!!11!!1!" | Should -BeExactly "Whoa, chill out!"
|
57
|
+
}
|
58
|
+
|
59
|
+
It "shouting with no exclamation mark" {
|
60
|
+
Get-BobResponse -HeyBob "I HATE YOU" | Should -BeExactly "Whoa, chill out!"
|
61
|
+
}
|
62
|
+
|
63
|
+
It "statement containing question mark" {
|
64
|
+
Get-BobResponse -HeyBob "Ending with ? means a question." | Should -BeExactly "Whatever."
|
65
|
+
}
|
66
|
+
|
67
|
+
It "non-letters with question" {
|
68
|
+
Get-BobResponse -HeyBob ":) ?" | Should -BeExactly "Sure."
|
69
|
+
}
|
70
|
+
|
71
|
+
It "prattling on" {
|
72
|
+
Get-BobResponse -HeyBob "Wait! Hang on. Are you going to be OK?" | Should -BeExactly "Sure."
|
73
|
+
}
|
74
|
+
|
75
|
+
It "silence" {
|
76
|
+
Get-BobResponse -HeyBob "" | Should -BeExactly "Fine. Be that way!"
|
77
|
+
}
|
78
|
+
|
79
|
+
It "prolonged silence" {
|
80
|
+
Get-BobResponse -HeyBob " " | Should -BeExactly "Fine. Be that way!"
|
81
|
+
}
|
82
|
+
|
83
|
+
It "alternate silence" {
|
84
|
+
Get-BobResponse -HeyBob " " | Should -BeExactly "Fine. Be that way!"
|
85
|
+
}
|
86
|
+
|
87
|
+
It "multiple line question" {
|
88
|
+
Get-BobResponse -HeyBob "
|
89
|
+
Does this cryogenic chamber make me look fat?
|
90
|
+
no" | Should -BeExactly "Whatever."
|
91
|
+
}
|
92
|
+
|
93
|
+
It "starting with whitespace" {
|
94
|
+
Get-BobResponse -HeyBob " hmmmmmmm..." | Should -BeExactly "Whatever."
|
95
|
+
}
|
96
|
+
|
97
|
+
It "ending with whitespace" {
|
98
|
+
Get-BobResponse -HeyBob "Okay if like my spacebar quite a bit? " | Should -BeExactly "Sure."
|
99
|
+
}
|
100
|
+
|
101
|
+
It "other whitespace" {
|
102
|
+
Get-BobResponse -HeyBob "
|
103
|
+
" | Should -BeExactly "Fine. Be that way!"
|
104
|
+
}
|
105
|
+
|
106
|
+
It "non-question ending with whitespace" {
|
107
|
+
Get-BobResponse -HeyBob "This is a statement ending with whitespace " | Should -BeExactly "Whatever."
|
108
|
+
}
|
109
|
+
}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# Bob
|
2
|
+
|
3
|
+
Bob is a lackadaisical teenager. In conversation, his responses are very limited.
|
4
|
+
|
5
|
+
Bob answers 'Sure.' if you ask him a question.
|
6
|
+
|
7
|
+
He answers 'Whoa, chill out!' if you yell at him.
|
8
|
+
|
9
|
+
He answers 'Calm down, I know what I'm doing!' if you yell a question at him.
|
10
|
+
|
11
|
+
He says 'Fine. Be that way!' if you address him without actually saying
|
12
|
+
anything.
|
13
|
+
|
14
|
+
He answers 'Whatever.' to anything else.
|
15
|
+
## Source
|
16
|
+
|
17
|
+
Inspired by the 'Deaf Grandma' exercise in Chris Pine's Learn to Program tutorial. [http://pine.fm/LearnToProgram/?Chapter=06](http://pine.fm/LearnToProgram/?Chapter=06)
|
18
|
+
|
19
|
+
## Submitting Incomplete Solutions
|
20
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
@@ -0,0 +1 @@
|
|
1
|
+
0
|
@@ -0,0 +1,36 @@
|
|
1
|
+
Function Get-NucleotideCount() {
|
2
|
+
[CmdletBinding()]
|
3
|
+
Param(
|
4
|
+
[string]$Strand = ""
|
5
|
+
)
|
6
|
+
|
7
|
+
$nucleotides = "ACGT"
|
8
|
+
$nucleotideRegEx = "^[$($nucleotides)]+$"
|
9
|
+
|
10
|
+
# Test for valid Strand values (empty string or made up of a string of ACGT characters in any order)
|
11
|
+
If ($Strand -ne "" -and $Strand -notmatch $nucleotideRegEx){
|
12
|
+
Throw "Invalid nucleotide in strand"
|
13
|
+
}
|
14
|
+
|
15
|
+
$result = ""
|
16
|
+
|
17
|
+
# Count the nucleotides in the strand
|
18
|
+
ForEach($nucleotide in $nucleotides.ToCharArray()){
|
19
|
+
$count = 0
|
20
|
+
For($i = 0; $i -lt $Strand.Length; $i++){
|
21
|
+
# Test if the current charcter in the strand is the nucleotide we are counting
|
22
|
+
If ($Strand[$i] -eq $nucleotide){
|
23
|
+
$count ++
|
24
|
+
}
|
25
|
+
}
|
26
|
+
|
27
|
+
# Add a space to the output if needed
|
28
|
+
If ($result -ne "") {
|
29
|
+
$result += " "
|
30
|
+
}
|
31
|
+
|
32
|
+
$result += ("{0}:{1}" -f $nucleotide, $count)
|
33
|
+
}
|
34
|
+
|
35
|
+
Return $result
|
36
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
|
2
|
+
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.tests\.', '.'
|
3
|
+
. "$here\$sut"
|
4
|
+
|
5
|
+
Describe "NucleotideCountTests" {
|
6
|
+
It "empty strand" {
|
7
|
+
Get-NucleotideCount -Strand "" | Should -BeExactly "A:0 C:0 G:0 T:0"
|
8
|
+
}
|
9
|
+
|
10
|
+
It "can count one nucleotide in single-character input" {
|
11
|
+
Get-NucleotideCount -Strand "G" | Should -BeExactly "A:0 C:0 G:1 T:0"
|
12
|
+
}
|
13
|
+
|
14
|
+
It "strand with repeated nucleotide" {
|
15
|
+
Get-NucleotideCount -Strand "GGGGGGG" | Should -BeExactly "A:0 C:0 G:7 T:0"
|
16
|
+
}
|
17
|
+
|
18
|
+
It "strand with multiple nucleotides" {
|
19
|
+
Get-NucleotideCount -Strand "AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC" | Should -BeExactly "A:20 C:12 G:17 T:21"
|
20
|
+
}
|
21
|
+
|
22
|
+
It "strand with invalid nucleotides" {
|
23
|
+
{ Get-NucleotideCount -Strand "AGXXACT" } | Should -Throw
|
24
|
+
}
|
25
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Nucleotide Count
|
2
|
+
|
3
|
+
Given a single stranded DNA string, compute how many times each nucleotide occurs in the string.
|
4
|
+
|
5
|
+
The genetic language of every living thing on the planet is DNA.
|
6
|
+
DNA is a large molecule that is built from an extremely long sequence of individual elements called nucleotides.
|
7
|
+
4 types exist in DNA and these differ only slightly and can be represented as the following symbols: 'A' for adenine, 'C' for cytosine, 'G' for guanine, and 'T' thymine.
|
8
|
+
|
9
|
+
Here is an analogy:
|
10
|
+
- twigs are to birds nests as
|
11
|
+
- nucleotides are to DNA as
|
12
|
+
- legos are to lego houses as
|
13
|
+
- words are to sentences as...
|
14
|
+
## Source
|
15
|
+
|
16
|
+
The Calculating DNA Nucleotides_problem at Rosalind [http://rosalind.info/problems/dna/](http://rosalind.info/problems/dna/)
|
17
|
+
|
18
|
+
## Submitting Incomplete Solutions
|
19
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
@@ -0,0 +1 @@
|
|
1
|
+
0
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# Raindrops
|
2
|
+
|
3
|
+
Convert a number to a string, the contents of which depend on the number's factors.
|
4
|
+
|
5
|
+
- If the number has 3 as a factor, output 'Pling'.
|
6
|
+
- If the number has 5 as a factor, output 'Plang'.
|
7
|
+
- If the number has 7 as a factor, output 'Plong'.
|
8
|
+
- If the number does not have 3, 5, or 7 as a factor,
|
9
|
+
just pass the number's digits straight through.
|
10
|
+
|
11
|
+
## Examples
|
12
|
+
|
13
|
+
- 28's factors are 1, 2, 4, **7**, 14, 28.
|
14
|
+
- In raindrop-speak, this would be a simple "Plong".
|
15
|
+
- 30's factors are 1, 2, **3**, **5**, 6, 10, 15, 30.
|
16
|
+
- In raindrop-speak, this would be a "PlingPlang".
|
17
|
+
- 34 has four factors: 1, 2, 17, and 34.
|
18
|
+
- In raindrop-speak, this would be "34".
|
19
|
+
## Source
|
20
|
+
|
21
|
+
A variation on a famous interview question intended to weed out potential candidates. [http://jumpstartlab.com](http://jumpstartlab.com)
|
22
|
+
|
23
|
+
## Submitting Incomplete Solutions
|
24
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
@@ -0,0 +1,32 @@
|
|
1
|
+
Function Get-Raindrops() {
|
2
|
+
[CmdletBinding()]
|
3
|
+
Param(
|
4
|
+
[int]$Rain
|
5
|
+
)
|
6
|
+
|
7
|
+
# Initialize the result
|
8
|
+
[string]$Result = ""
|
9
|
+
|
10
|
+
# Use a hashtable to list the factors and what they are replaced with
|
11
|
+
$factorRain = @{
|
12
|
+
3 = "Pling";
|
13
|
+
5 = "Plang";
|
14
|
+
7 = "Plong";
|
15
|
+
}
|
16
|
+
|
17
|
+
# Loop over the hashtable testing the factors and building up the result.
|
18
|
+
# NOTE: You must sort hashtables if order is important. See: https://blogs.technet.microsoft.com/heyscriptingguy/2014/09/28/weekend-scripter-sorting-powershell-hash-tables/
|
19
|
+
Foreach($factor in ($factorRain.GetEnumerator() | Sort-Object -Property Name)){
|
20
|
+
If($Rain % $factor.Name -eq 0){
|
21
|
+
$Result += $factor.Value
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
# Deal with the case that no factors are found so passthrough the original value
|
26
|
+
If ([string]::IsNullOrEmpty($Result)){
|
27
|
+
$Result = $Rain.ToString()
|
28
|
+
}
|
29
|
+
|
30
|
+
# Return the resulting string
|
31
|
+
Return $Result
|
32
|
+
}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
|
2
|
+
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.tests\.', '.'
|
3
|
+
. "$here\$sut"
|
4
|
+
|
5
|
+
Describe "Test Get-Raindrops" {
|
6
|
+
|
7
|
+
It "Given the number <Number> it should output <Result>" -TestCases @(
|
8
|
+
@{ Number = 1; Result = "1" },
|
9
|
+
@{ Number = 3; Result = "Pling" },
|
10
|
+
@{ Number = 5; Result = "Plang" },
|
11
|
+
@{ Number = 7; Result = "Plong" },
|
12
|
+
@{ Number = 6; Result = "Pling" },
|
13
|
+
@{ Number = 9; Result = "Pling" },
|
14
|
+
@{ Number = 10; Result = "Plang" },
|
15
|
+
@{ Number = 14; Result = "Plong" },
|
16
|
+
@{ Number = 15; Result = "PlingPlang" },
|
17
|
+
@{ Number = 21; Result = "PlingPlong" },
|
18
|
+
@{ Number = 25; Result = "Plang" },
|
19
|
+
@{ Number = 27; Result = "Pling" },
|
20
|
+
@{ Number = 35; Result = "PlangPlong" },
|
21
|
+
@{ Number = 49; Result = "Plong" },
|
22
|
+
@{ Number = 52; Result = "52" },
|
23
|
+
@{ Number = 105; Result = "PlingPlangPlong" },
|
24
|
+
@{ Number = 3125; Result = "Plang" },
|
25
|
+
@{ Number = 12121; Result = "12121" }
|
26
|
+
) {
|
27
|
+
Param(
|
28
|
+
[int]$Number,
|
29
|
+
[string]$Result
|
30
|
+
)
|
31
|
+
|
32
|
+
Get-Raindrops -Rain $Number | Should -BeExactly $Result
|
33
|
+
}
|
34
|
+
}
|
@@ -4,10 +4,37 @@ pending :-
|
|
4
4
|
write('\nA TEST IS PENDING!\n'),
|
5
5
|
fail.
|
6
6
|
|
7
|
+
:- begin_tests(real_part).
|
8
|
+
|
9
|
+
test(real_part_of_a_purely_real_number, condition(true)) :-
|
10
|
+
real((1,0),1).
|
11
|
+
|
12
|
+
test(real_part_of_a_purely_imaginary_number, condition(pending)) :-
|
13
|
+
real((0,1),0).
|
14
|
+
|
15
|
+
test(real_part_of_a_number_with_real_and_imaginary_part, condition(pending)) :-
|
16
|
+
real((1,2),1).
|
17
|
+
|
18
|
+
:- end_tests(real_part).
|
19
|
+
|
20
|
+
|
21
|
+
:- begin_tests(imaginary_part).
|
22
|
+
|
23
|
+
test(imaginary_part_of_a_purely_real_number, condition(pending)) :-
|
24
|
+
imaginary((1,0),0).
|
25
|
+
|
26
|
+
test(imaginary_part_of_a_purely_imaginary_number, condition(pending)) :-
|
27
|
+
imaginary((0,1),1).
|
28
|
+
|
29
|
+
test(imaginary_part_of_a_number_with_real_and_imaginary_part, condition(pending)) :-
|
30
|
+
imaginary((1,2),2).
|
31
|
+
|
32
|
+
:- end_tests(imaginary_part).
|
33
|
+
|
7
34
|
|
8
35
|
:- begin_tests(addition).
|
9
36
|
|
10
|
-
test(add_purely_real_numbers, condition(
|
37
|
+
test(add_purely_real_numbers, condition(pending)) :-
|
11
38
|
add((1,0), (2,0), (3,0)).
|
12
39
|
|
13
40
|
test(add_purely_imaginary_numbers, condition(pending)) :-
|
@@ -93,31 +120,3 @@ pending :-
|
|
93
120
|
conjugate((1,1), (1,-1)).
|
94
121
|
|
95
122
|
:- end_tests(conjugate).
|
96
|
-
|
97
|
-
|
98
|
-
:- begin_tests(real_part).
|
99
|
-
|
100
|
-
test(real_part_of_a_purely_real_number, condition(true)) :-
|
101
|
-
real((1,0),1).
|
102
|
-
|
103
|
-
test(real_part_of_a_purely_imaginary_number, condition(true)) :-
|
104
|
-
real((0,1),0).
|
105
|
-
|
106
|
-
test(real_part_of_a_number_with_real_and_imaginary_part, condition(true)) :-
|
107
|
-
real((1,2),1).
|
108
|
-
|
109
|
-
:- end_tests(real_part).
|
110
|
-
|
111
|
-
|
112
|
-
:- begin_tests(imaginary_part).
|
113
|
-
|
114
|
-
test(imagianry_part_of_a_purely_real_number, condition(true)) :-
|
115
|
-
imaginary((1,0),0).
|
116
|
-
|
117
|
-
test(imaginary_part_of_a_purely_imaginary_number, condition(true)) :-
|
118
|
-
imaginary((0,1),1).
|
119
|
-
|
120
|
-
test(imaginary_part_of_a_number_with_real_and_imaginary_part, condition(true)) :-
|
121
|
-
imaginary((1,2),2).
|
122
|
-
|
123
|
-
:- end_tests(imaginary_part).
|
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2018 Exercism, Inc
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|