trackler 2.2.1.111 → 2.2.1.113
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/problem-specifications/README.md +6 -2
- data/problem-specifications/exercises/go-counting/canonical-data.json +200 -0
- data/problem-specifications/exercises/go-counting/description.md +2 -0
- data/tracks/c/config.json +24 -0
- data/tracks/c/exercises/minesweeper/README.md +26 -0
- data/tracks/c/exercises/minesweeper/makefile +25 -0
- data/tracks/c/exercises/minesweeper/src/example.c +64 -0
- data/tracks/c/exercises/minesweeper/src/example.h +7 -0
- data/tracks/c/exercises/minesweeper/test/test_minesweeper.c +261 -0
- data/tracks/c/exercises/minesweeper/test/vendor/unity.c +1300 -0
- data/tracks/c/exercises/minesweeper/test/vendor/unity.h +274 -0
- data/tracks/c/exercises/minesweeper/test/vendor/unity_internals.h +701 -0
- data/tracks/c/exercises/run-length-encoding/README.md +23 -0
- data/tracks/c/exercises/run-length-encoding/makefile +27 -0
- data/tracks/c/exercises/run-length-encoding/src/example.c +126 -0
- data/tracks/c/exercises/run-length-encoding/src/example.h +7 -0
- data/tracks/c/exercises/run-length-encoding/test/test_run_length_encoding.c +139 -0
- data/tracks/c/exercises/run-length-encoding/test/vendor/unity.c +1300 -0
- data/tracks/c/exercises/run-length-encoding/test/vendor/unity.h +274 -0
- data/tracks/c/exercises/run-length-encoding/test/vendor/unity_internals.h +701 -0
- data/tracks/delphi/exercises/clock/uClockTest.pas +6 -6
- data/tracks/ecmascript/config.json +11 -0
- data/tracks/ecmascript/exercises/armstrong-numbers/README.md +48 -0
- data/tracks/ecmascript/exercises/armstrong-numbers/armstrong-numbers.spec.js +43 -0
- data/tracks/ecmascript/exercises/armstrong-numbers/example.js +11 -0
- data/tracks/ecmascript/exercises/armstrong-numbers/package.json +70 -0
- data/tracks/javascript/config.json +11 -0
- data/tracks/javascript/exercises/armstrong-numbers/README.md +46 -0
- data/tracks/javascript/exercises/armstrong-numbers/armstrong-numbers.spec.js +43 -0
- data/tracks/javascript/exercises/armstrong-numbers/example.js +11 -0
- data/tracks/objective-c/config.json +12 -0
- data/tracks/objective-c/exercises/series/README.md +50 -0
- data/tracks/objective-c/exercises/series/SeriesExample.h +12 -0
- data/tracks/objective-c/exercises/series/SeriesExample.m +50 -0
- data/tracks/objective-c/exercises/series/SeriesTest.m +97 -0
- data/tracks/objective-c/xcodeProject/ObjectiveC.xcodeproj/project.pbxproj +18 -0
- data/tracks/rust/exercises/gigasecond/.meta/hints.md +1 -0
- data/tracks/rust/exercises/gigasecond/README.md +3 -0
- data/tracks/rust/exercises/gigasecond/example.rs +1 -1
- data/tracks/rust/exercises/gigasecond/src/lib.rs +7 -7
- data/tracks/rust/exercises/gigasecond/tests/gigasecond.rs +1 -1
- data/tracks/rust/exercises/prime-factors/src/lib.rs +3 -0
- data/tracks/scala/exercises/saddle-points/src/test/scala/SaddlePointsTest.scala +1 -1
- data/tracks/scala/exercises/say/src/test/scala/SayTest.scala +18 -19
- data/tracks/scala/exercises/scrabble-score/src/test/scala/ScrabbleScoreTest.scala +13 -13
- data/tracks/scala/testgen/src/main/scala/SaddlePointsTestGenerator.scala +3 -3
- data/tracks/scala/testgen/src/main/scala/SayTestGenerator.scala +6 -6
- data/tracks/scala/testgen/src/main/scala/ScrabbleScoreTestGenerator.scala +2 -2
- data/tracks/typescript/config.json +16 -0
- data/tracks/typescript/exercises/simple-cipher/README.md +114 -0
- data/tracks/typescript/exercises/simple-cipher/package.json +36 -0
- data/tracks/typescript/exercises/simple-cipher/simple-cipher.example.ts +42 -0
- data/tracks/typescript/exercises/simple-cipher/simple-cipher.test.ts +84 -0
- data/tracks/typescript/exercises/simple-cipher/simple-cipher.ts +11 -0
- data/tracks/typescript/exercises/simple-cipher/tsconfig.json +22 -0
- data/tracks/typescript/exercises/simple-cipher/tslint.json +127 -0
- data/tracks/typescript/exercises/simple-cipher/yarn.lock +2624 -0
- metadata +39 -2
@@ -0,0 +1,50 @@
|
|
1
|
+
#import "SeriesExample.h"
|
2
|
+
|
3
|
+
@interface Series()
|
4
|
+
|
5
|
+
@property (nonatomic, strong) NSString *numberString;
|
6
|
+
|
7
|
+
@end
|
8
|
+
|
9
|
+
@implementation Series
|
10
|
+
|
11
|
+
- (instancetype)initWithNumberString:(NSString *)numberString {
|
12
|
+
if (self = [super init]) {
|
13
|
+
self.numberString = numberString;
|
14
|
+
}
|
15
|
+
|
16
|
+
return self;
|
17
|
+
}
|
18
|
+
|
19
|
+
- (nullable NSArray<NSArray<NSNumber *> *> *)slicesWithSize:(NSInteger)size {
|
20
|
+
NSUInteger length = [self.numberString length];
|
21
|
+
|
22
|
+
if (length < size) {
|
23
|
+
return nil;
|
24
|
+
}
|
25
|
+
|
26
|
+
NSMutableArray<NSNumber *> *numberArray = [NSMutableArray arrayWithCapacity:length];
|
27
|
+
|
28
|
+
for (NSUInteger i = 0; i < length; i++) {
|
29
|
+
unichar digit = [self.numberString characterAtIndex:i] - '0';
|
30
|
+
if (digit < 0 || digit > 10) {
|
31
|
+
// Invalid character
|
32
|
+
return nil;
|
33
|
+
}
|
34
|
+
|
35
|
+
[numberArray addObject:[NSNumber numberWithUnsignedShort:digit]];
|
36
|
+
}
|
37
|
+
|
38
|
+
NSInteger numberOfSlices = length - size + 1;
|
39
|
+
NSMutableArray<NSArray<NSNumber *> *> *result = [NSMutableArray arrayWithCapacity:numberOfSlices];
|
40
|
+
|
41
|
+
for (NSUInteger start = 0; start < numberOfSlices; start++) {
|
42
|
+
NSRange range = NSMakeRange(start, size);
|
43
|
+
NSArray *slice = [numberArray subarrayWithRange:range];
|
44
|
+
[result addObject:slice];
|
45
|
+
}
|
46
|
+
|
47
|
+
return result;
|
48
|
+
}
|
49
|
+
|
50
|
+
@end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
#import <XCTest/XCTest.h>
|
2
|
+
|
3
|
+
#if __has_include("SeriesExample.h")
|
4
|
+
#import "SeriesExample.h"
|
5
|
+
#else
|
6
|
+
#import "Series.h"
|
7
|
+
#endif
|
8
|
+
|
9
|
+
@interface SeriesTest : XCTestCase
|
10
|
+
|
11
|
+
@end
|
12
|
+
|
13
|
+
@implementation SeriesTest
|
14
|
+
|
15
|
+
- (void)testSimpleSlicesOfOne {
|
16
|
+
Series *series = [[Series alloc] initWithNumberString:@"01234"];
|
17
|
+
NSArray *expected = @[@[@0], @[@1], @[@2], @[@3], @[@4]];
|
18
|
+
XCTAssertEqualObjects(expected, [series slicesWithSize:1]);
|
19
|
+
}
|
20
|
+
|
21
|
+
- (void)testSimpleSlicesOfOneAgain {
|
22
|
+
Series *series = [[Series alloc] initWithNumberString:@"92834"];
|
23
|
+
NSArray *expected = @[@[@9], @[@2], @[@8], @[@3], @[@4]];
|
24
|
+
XCTAssertEqualObjects(expected, [series slicesWithSize:1]);
|
25
|
+
}
|
26
|
+
|
27
|
+
- (void)testSimpleSlicesOfTwo {
|
28
|
+
Series *series = [[Series alloc] initWithNumberString:@"01234"];
|
29
|
+
NSArray *expected = @[@[@0, @1], @[@1, @2], @[@2, @3], @[@3, @4]];
|
30
|
+
XCTAssertEqualObjects(expected, [series slicesWithSize:2]);
|
31
|
+
}
|
32
|
+
|
33
|
+
- (void)testOtherSlicesOfTwo {
|
34
|
+
Series *series = [[Series alloc] initWithNumberString:@"98273463"];
|
35
|
+
NSArray *expected = @[@[@9, @8], @[@8, @2], @[@2, @7], @[@7, @3], @[@3, @4], @[@4, @6], @[@6, @3]];
|
36
|
+
XCTAssertEqualObjects(expected, [series slicesWithSize:2]);
|
37
|
+
}
|
38
|
+
|
39
|
+
- (void)testSimpleSlicesOfTwoAgain {
|
40
|
+
Series *series = [[Series alloc] initWithNumberString:@"37103"];
|
41
|
+
NSArray *expected = @[@[@3, @7], @[@7, @1], @[@1, @0], @[@0, @3]];
|
42
|
+
XCTAssertEqualObjects(expected, [series slicesWithSize:2]);
|
43
|
+
}
|
44
|
+
|
45
|
+
- (void)testSimpleSlicesOfThree {
|
46
|
+
Series *series = [[Series alloc] initWithNumberString:@"01234"];
|
47
|
+
NSArray *expected = @[@[@0, @1, @2], @[@1, @2, @3], @[@2, @3, @4]];
|
48
|
+
XCTAssertEqualObjects(expected, [series slicesWithSize:3]);
|
49
|
+
}
|
50
|
+
|
51
|
+
- (void)testSimpleSlicesOfThreeAgain {
|
52
|
+
Series *series = [[Series alloc] initWithNumberString:@"31001"];
|
53
|
+
NSArray *expected = @[@[@3, @1, @0], @[@1, @0, @0], @[@0, @0, @1]];
|
54
|
+
XCTAssertEqualObjects(expected, [series slicesWithSize:3]);
|
55
|
+
}
|
56
|
+
|
57
|
+
- (void)testOtherSlicesOfThree {
|
58
|
+
Series *series = [[Series alloc] initWithNumberString:@"982347"];
|
59
|
+
NSArray *expected = @[@[@9, @8, @2], @[@8, @2, @3], @[@2, @3, @4], @[@3, @4, @7]];
|
60
|
+
XCTAssertEqualObjects(expected, [series slicesWithSize:3]);
|
61
|
+
}
|
62
|
+
|
63
|
+
- (void)testSimpleSlicesOfFour {
|
64
|
+
Series *series = [[Series alloc] initWithNumberString:@"01234"];
|
65
|
+
NSArray *expected = @[@[@0, @1, @2, @3], @[@1, @2, @3, @4]];
|
66
|
+
XCTAssertEqualObjects(expected, [series slicesWithSize:4]);
|
67
|
+
}
|
68
|
+
|
69
|
+
- (void)testSimpleSlicesOfFourAgain {
|
70
|
+
Series *series = [[Series alloc] initWithNumberString:@"91274"];
|
71
|
+
NSArray *expected = @[@[@9, @1, @2, @7], @[@1, @2, @7, @4]];
|
72
|
+
XCTAssertEqualObjects(expected, [series slicesWithSize:4]);
|
73
|
+
}
|
74
|
+
|
75
|
+
- (void)testSimpleSlicesOfFive {
|
76
|
+
Series *series = [[Series alloc] initWithNumberString:@"01234"];
|
77
|
+
NSArray *expected = @[@[@0, @1, @2, @3, @4]];
|
78
|
+
XCTAssertEqualObjects(expected, [series slicesWithSize:5]);
|
79
|
+
}
|
80
|
+
|
81
|
+
- (void)testSimpleSlicesOfFiveAgain {
|
82
|
+
Series *series = [[Series alloc] initWithNumberString:@"81228"];
|
83
|
+
NSArray *expected = @[@[@8, @1, @2, @2, @8]];
|
84
|
+
XCTAssertEqualObjects(expected, [series slicesWithSize:5]);
|
85
|
+
}
|
86
|
+
|
87
|
+
- (void)testSimpleSliceThatBlowsUp {
|
88
|
+
Series *series = [[Series alloc] initWithNumberString:@"01234"];
|
89
|
+
XCTAssertNil([series slicesWithSize:6]);
|
90
|
+
}
|
91
|
+
|
92
|
+
- (void)testMoreComplicatedSliceThatBlowsUp {
|
93
|
+
Series *series = [[Series alloc] initWithNumberString:@"01032987583"];
|
94
|
+
XCTAssertNil([series slicesWithSize:12]);
|
95
|
+
}
|
96
|
+
|
97
|
+
@end
|
@@ -63,6 +63,8 @@
|
|
63
63
|
E907D0CC1D6B734800106C42 /* GigasecondTest.m in Sources */ = {isa = PBXBuildFile; fileRef = E907D0CB1D6B734800106C42 /* GigasecondTest.m */; };
|
64
64
|
E907FE921D87547D00B93DA9 /* ScrabbleScoreExample.m in Sources */ = {isa = PBXBuildFile; fileRef = E907FE911D87547D00B93DA9 /* ScrabbleScoreExample.m */; };
|
65
65
|
E907FE941D87554500B93DA9 /* ScrabbleScoreTest.m in Sources */ = {isa = PBXBuildFile; fileRef = E907FE931D87554500B93DA9 /* ScrabbleScoreTest.m */; };
|
66
|
+
E90E59CA204891DD008C0FB5 /* SeriesExample.m in Sources */ = {isa = PBXBuildFile; fileRef = E90E59C9204891DD008C0FB5 /* SeriesExample.m */; };
|
67
|
+
E90E59CC204891F7008C0FB5 /* SeriesTest.m in Sources */ = {isa = PBXBuildFile; fileRef = E90E59CB204891F7008C0FB5 /* SeriesTest.m */; };
|
66
68
|
E92FCC0D1D78F30D00061017 /* MeetupExample.m in Sources */ = {isa = PBXBuildFile; fileRef = E92FCC0C1D78F30D00061017 /* MeetupExample.m */; };
|
67
69
|
E92FCC0F1D78F3B600061017 /* MeetupTest.m in Sources */ = {isa = PBXBuildFile; fileRef = E92FCC0E1D78F3B600061017 /* MeetupTest.m */; };
|
68
70
|
E9340D06201975C9009FDEF4 /* CollatzConjectureExample.m in Sources */ = {isa = PBXBuildFile; fileRef = E9340D05201975C9009FDEF4 /* CollatzConjectureExample.m */; };
|
@@ -181,6 +183,9 @@
|
|
181
183
|
E907FE901D87547D00B93DA9 /* ScrabbleScoreExample.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ScrabbleScoreExample.h; path = "../../exercises/scrabble-score/ScrabbleScoreExample.h"; sourceTree = "<group>"; };
|
182
184
|
E907FE911D87547D00B93DA9 /* ScrabbleScoreExample.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ScrabbleScoreExample.m; path = "../../exercises/scrabble-score/ScrabbleScoreExample.m"; sourceTree = "<group>"; };
|
183
185
|
E907FE931D87554500B93DA9 /* ScrabbleScoreTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ScrabbleScoreTest.m; path = "../../exercises/scrabble-score/ScrabbleScoreTest.m"; sourceTree = "<group>"; };
|
186
|
+
E90E59C8204891DD008C0FB5 /* SeriesExample.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SeriesExample.h; path = ../../exercises/series/SeriesExample.h; sourceTree = "<group>"; };
|
187
|
+
E90E59C9204891DD008C0FB5 /* SeriesExample.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = SeriesExample.m; path = ../../exercises/series/SeriesExample.m; sourceTree = "<group>"; };
|
188
|
+
E90E59CB204891F7008C0FB5 /* SeriesTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = SeriesTest.m; path = ../../exercises/series/SeriesTest.m; sourceTree = "<group>"; };
|
184
189
|
E92FCC0B1D78F30D00061017 /* MeetupExample.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MeetupExample.h; path = ../../exercises/meetup/MeetupExample.h; sourceTree = "<group>"; };
|
185
190
|
E92FCC0C1D78F30D00061017 /* MeetupExample.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MeetupExample.m; path = ../../exercises/meetup/MeetupExample.m; sourceTree = "<group>"; };
|
186
191
|
E92FCC0E1D78F3B600061017 /* MeetupTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MeetupTest.m; path = ../../exercises/meetup/MeetupTest.m; sourceTree = "<group>"; };
|
@@ -310,6 +315,7 @@
|
|
310
315
|
E964F68C1FBF9B6B000114D9 /* Say */,
|
311
316
|
E907FE8F1D87545300B93DA9 /* ScrabbleScore */,
|
312
317
|
E9C1C0201D9D98B80015E86E /* SecretHandshake */,
|
318
|
+
E90E59C720489199008C0FB5 /* Series */,
|
313
319
|
E97320091E9DA06500ABEE5C /* Sieve */,
|
314
320
|
E9E8B6F61D519E340012F12C /* SpaceAge */,
|
315
321
|
A0BBFCBC1E37703D00230071 /* Sublist */,
|
@@ -420,6 +426,16 @@
|
|
420
426
|
name = ScrabbleScore;
|
421
427
|
sourceTree = "<group>";
|
422
428
|
};
|
429
|
+
E90E59C720489199008C0FB5 /* Series */ = {
|
430
|
+
isa = PBXGroup;
|
431
|
+
children = (
|
432
|
+
E90E59C8204891DD008C0FB5 /* SeriesExample.h */,
|
433
|
+
E90E59C9204891DD008C0FB5 /* SeriesExample.m */,
|
434
|
+
E90E59CB204891F7008C0FB5 /* SeriesTest.m */,
|
435
|
+
);
|
436
|
+
name = Series;
|
437
|
+
sourceTree = "<group>";
|
438
|
+
};
|
423
439
|
E92FCC0A1D78F2AA00061017 /* Meetup */ = {
|
424
440
|
isa = PBXGroup;
|
425
441
|
children = (
|
@@ -947,6 +963,7 @@
|
|
947
963
|
1EFACAB71CCCAF3D006F2E69 /* RobotNameExample.m in Sources */,
|
948
964
|
E9FCFED31E98333D003080C0 /* PascalsTriangleExample.m in Sources */,
|
949
965
|
1EFACAA51CCCAF3D006F2E69 /* BobExample.m in Sources */,
|
966
|
+
E90E59CA204891DD008C0FB5 /* SeriesExample.m in Sources */,
|
950
967
|
1EFACABB1CCCAF3D006F2E69 /* WordCountExample.m in Sources */,
|
951
968
|
1EFACAB01CCCAF3D006F2E69 /* LeapTest.m in Sources */,
|
952
969
|
1EFACAAB1CCCAF3D006F2E69 /* HammingExample.m in Sources */,
|
@@ -969,6 +986,7 @@
|
|
969
986
|
E90343B62041F989006F1833 /* PrimeFactorsExample.m in Sources */,
|
970
987
|
E9B9F2D41E9EB39C00214076 /* LuhnExample.m in Sources */,
|
971
988
|
E9A7B2F91DA5AC55009056B6 /* LargestSeriesProductTest.m in Sources */,
|
989
|
+
E90E59CC204891F7008C0FB5 /* SeriesTest.m in Sources */,
|
972
990
|
1EFACAAF1CCCAF3D006F2E69 /* LeapExample.m in Sources */,
|
973
991
|
E9386EF01E0B694D0009A414 /* AtbashCipherTest.m in Sources */,
|
974
992
|
E9340D08201975E5009FDEF4 /* CollatzConjectureTest.m in Sources */,
|
@@ -0,0 +1 @@
|
|
1
|
+
If you're unsure what operations you can perform on `DateTime<Utc>` take a look at the [chrono crate](https://docs.rs/chrono/0.4.0/chrono/) which is listed as a dependency in the `Cargo.toml` file for this exercise.
|
@@ -4,6 +4,9 @@ Calculate the moment when someone has lived for 10^9 seconds.
|
|
4
4
|
|
5
5
|
A gigasecond is 10^9 (1,000,000,000) seconds.
|
6
6
|
|
7
|
+
If you're unsure what operations you can perform on `DateTime<Utc>` take a look at the [chrono crate](https://docs.rs/chrono/0.4.0/chrono/) which is listed as a dependency in the `Cargo.toml` file for this exercise.
|
8
|
+
|
9
|
+
|
7
10
|
## Rust Installation
|
8
11
|
|
9
12
|
Refer to the [exercism help page][help-page] for Rust installation and learning
|
@@ -1,7 +1,7 @@
|
|
1
|
-
extern crate chrono;
|
2
|
-
use chrono
|
3
|
-
|
4
|
-
// Returns a Utc DateTime one billion seconds after start.
|
5
|
-
pub fn after(start: DateTime<Utc>) -> DateTime<Utc> {
|
6
|
-
unimplemented!()
|
7
|
-
}
|
1
|
+
extern crate chrono;
|
2
|
+
use chrono::{DateTime, Utc};
|
3
|
+
|
4
|
+
// Returns a Utc DateTime one billion seconds after start.
|
5
|
+
pub fn after(start: DateTime<Utc>) -> DateTime<Utc> {
|
6
|
+
unimplemented!("What time is a gigasecond later than {}", start);
|
7
|
+
}
|
@@ -1,80 +1,79 @@
|
|
1
1
|
import org.scalatest.{Matchers, FunSuite}
|
2
2
|
|
3
|
-
/** @version 1.
|
3
|
+
/** @version 1.1.0 */
|
4
4
|
class SayTest extends FunSuite with Matchers {
|
5
|
-
|
5
|
+
|
6
6
|
test("zero") {
|
7
|
-
Say.inEnglish(0) should be
|
7
|
+
Say.inEnglish(0) should be(Some("zero"))
|
8
8
|
}
|
9
9
|
|
10
10
|
test("one") {
|
11
11
|
pending
|
12
|
-
Say.inEnglish(1) should be
|
12
|
+
Say.inEnglish(1) should be(Some("one"))
|
13
13
|
}
|
14
14
|
|
15
15
|
test("fourteen") {
|
16
16
|
pending
|
17
|
-
Say.inEnglish(14) should be
|
17
|
+
Say.inEnglish(14) should be(Some("fourteen"))
|
18
18
|
}
|
19
19
|
|
20
20
|
test("twenty") {
|
21
21
|
pending
|
22
|
-
Say.inEnglish(20) should be
|
22
|
+
Say.inEnglish(20) should be(Some("twenty"))
|
23
23
|
}
|
24
24
|
|
25
25
|
test("twenty-two") {
|
26
26
|
pending
|
27
|
-
Say.inEnglish(22) should be
|
27
|
+
Say.inEnglish(22) should be(Some("twenty-two"))
|
28
28
|
}
|
29
29
|
|
30
30
|
test("one hundred") {
|
31
31
|
pending
|
32
|
-
Say.inEnglish(100) should be
|
32
|
+
Say.inEnglish(100) should be(Some("one hundred"))
|
33
33
|
}
|
34
34
|
|
35
35
|
test("one hundred twenty-three") {
|
36
36
|
pending
|
37
|
-
Say.inEnglish(123) should be
|
37
|
+
Say.inEnglish(123) should be(Some("one hundred twenty-three"))
|
38
38
|
}
|
39
39
|
|
40
40
|
test("one thousand") {
|
41
41
|
pending
|
42
|
-
Say.inEnglish(1000) should be
|
42
|
+
Say.inEnglish(1000) should be(Some("one thousand"))
|
43
43
|
}
|
44
44
|
|
45
45
|
test("one thousand two hundred thirty-four") {
|
46
46
|
pending
|
47
|
-
Say.inEnglish(1234) should be
|
47
|
+
Say.inEnglish(1234) should be(Some("one thousand two hundred thirty-four"))
|
48
48
|
}
|
49
49
|
|
50
50
|
test("one million") {
|
51
51
|
pending
|
52
|
-
Say.inEnglish(1000000) should be
|
52
|
+
Say.inEnglish(1000000) should be(Some("one million"))
|
53
53
|
}
|
54
54
|
|
55
55
|
test("one million two thousand three hundred forty-five") {
|
56
56
|
pending
|
57
|
-
Say.inEnglish(1002345) should be
|
57
|
+
Say.inEnglish(1002345) should be(Some("one million two thousand three hundred forty-five"))
|
58
58
|
}
|
59
59
|
|
60
60
|
test("one billion") {
|
61
61
|
pending
|
62
|
-
Say.inEnglish(1000000000) should be
|
62
|
+
Say.inEnglish(1000000000) should be(Some("one billion"))
|
63
63
|
}
|
64
64
|
|
65
65
|
test("a big number") {
|
66
66
|
pending
|
67
|
-
Say.inEnglish(987654321123l) should
|
68
|
-
be (Some("nine hundred eighty-seven billion six hundred fifty-four million three hundred twenty-one thousand one hundred twenty-three"))
|
67
|
+
Say.inEnglish(987654321123l) should be(Some("nine hundred eighty-seven billion six hundred fifty-four million three hundred twenty-one thousand one hundred twenty-three"))
|
69
68
|
}
|
70
69
|
|
71
70
|
test("numbers below zero are out of range") {
|
72
71
|
pending
|
73
|
-
Say.inEnglish(-1) should be
|
72
|
+
Say.inEnglish(-1) should be(None)
|
74
73
|
}
|
75
74
|
|
76
75
|
test("numbers above 999,999,999,999 are out of range") {
|
77
76
|
pending
|
78
|
-
Say.inEnglish(1000000000000l) should be
|
77
|
+
Say.inEnglish(1000000000000l) should be(None)
|
79
78
|
}
|
80
|
-
}
|
79
|
+
}
|
@@ -1,59 +1,59 @@
|
|
1
1
|
import org.scalatest.{Matchers, FunSuite}
|
2
2
|
|
3
|
-
/** @version 1.
|
3
|
+
/** @version 1.1.0 */
|
4
4
|
class ScrabbleScoreTest extends FunSuite with Matchers {
|
5
5
|
|
6
6
|
test("lowercase letter") {
|
7
|
-
ScrabbleScore.score("a") should be
|
7
|
+
ScrabbleScore.score("a") should be(1)
|
8
8
|
}
|
9
9
|
|
10
10
|
test("uppercase letter") {
|
11
11
|
pending
|
12
|
-
ScrabbleScore.score("A") should be
|
12
|
+
ScrabbleScore.score("A") should be(1)
|
13
13
|
}
|
14
14
|
|
15
15
|
test("valuable letter") {
|
16
16
|
pending
|
17
|
-
ScrabbleScore.score("f") should be
|
17
|
+
ScrabbleScore.score("f") should be(4)
|
18
18
|
}
|
19
19
|
|
20
20
|
test("short word") {
|
21
21
|
pending
|
22
|
-
ScrabbleScore.score("at") should be
|
22
|
+
ScrabbleScore.score("at") should be(2)
|
23
23
|
}
|
24
24
|
|
25
25
|
test("short, valuable word") {
|
26
26
|
pending
|
27
|
-
ScrabbleScore.score("zoo") should be
|
27
|
+
ScrabbleScore.score("zoo") should be(12)
|
28
28
|
}
|
29
29
|
|
30
30
|
test("medium word") {
|
31
31
|
pending
|
32
|
-
ScrabbleScore.score("street") should be
|
32
|
+
ScrabbleScore.score("street") should be(6)
|
33
33
|
}
|
34
34
|
|
35
35
|
test("medium, valuable word") {
|
36
36
|
pending
|
37
|
-
ScrabbleScore.score("quirky") should be
|
37
|
+
ScrabbleScore.score("quirky") should be(22)
|
38
38
|
}
|
39
39
|
|
40
40
|
test("long, mixed-case word") {
|
41
41
|
pending
|
42
|
-
ScrabbleScore.score("OxyphenButazone") should be
|
42
|
+
ScrabbleScore.score("OxyphenButazone") should be(41)
|
43
43
|
}
|
44
44
|
|
45
45
|
test("english-like word") {
|
46
46
|
pending
|
47
|
-
ScrabbleScore.score("pinata") should be
|
47
|
+
ScrabbleScore.score("pinata") should be(8)
|
48
48
|
}
|
49
49
|
|
50
50
|
test("empty input") {
|
51
51
|
pending
|
52
|
-
ScrabbleScore.score("") should be
|
52
|
+
ScrabbleScore.score("") should be(0)
|
53
53
|
}
|
54
54
|
|
55
55
|
test("entire alphabet available") {
|
56
56
|
pending
|
57
|
-
ScrabbleScore.score("abcdefghijklmnopqrstuvwxyz") should be
|
57
|
+
ScrabbleScore.score("abcdefghijklmnopqrstuvwxyz") should be(87)
|
58
58
|
}
|
59
|
-
}
|
59
|
+
}
|
@@ -13,10 +13,10 @@ object SaddlePointsTestGenerator {
|
|
13
13
|
}
|
14
14
|
}
|
15
15
|
|
16
|
-
def
|
16
|
+
def fromLabeledTestFromInput(argNames: String*): ToTestCaseData =
|
17
17
|
withLabeledTest { sut =>
|
18
18
|
labeledTest =>
|
19
|
-
val args =
|
19
|
+
val args = sutArgsFromInput(labeledTest.result, argNames: _*)
|
20
20
|
val property = labeledTest.property
|
21
21
|
val sutCall =
|
22
22
|
s"""Matrix($args).$property"""
|
@@ -27,7 +27,7 @@ object SaddlePointsTestGenerator {
|
|
27
27
|
def main(args: Array[String]): Unit = {
|
28
28
|
val file = new File("src/main/resources/saddle-points.json")
|
29
29
|
|
30
|
-
val code = TestSuiteBuilder.build(file,
|
30
|
+
val code = TestSuiteBuilder.build(file, fromLabeledTestFromInput("matrix"))
|
31
31
|
println(s"-------------")
|
32
32
|
println(code)
|
33
33
|
println(s"-------------")
|