Skip to content

Commit 27e17ba

Browse files
committed
Added spec test for BubbleSort
1 parent 7b74e96 commit 27e17ba

3 files changed

Lines changed: 72 additions & 3 deletions

File tree

.circleci/config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ jobs:
77
- develop
88
- master
99
docker:
10-
- image: maciejmalecki/c64libci:0.1.4
10+
- image: maciejmalecki/c64libci:0.1.7
1111

1212
working_directory: ~/repo
1313

1414
environment:
15-
JVM_OPTS: -Xms256m -Xmx768m
15+
JVM_OPTS: -Xmx3200m
1616
TERM: dumb
1717

1818
steps:
1919
- checkout
20-
- run: ./gradlew
20+
- run: ./gradlew -x test

build.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ retroProject {
1010
dialect = "KickAssembler"
1111
dialectVersion = "5.25"
1212
libDirs = ["..", ".ra/deps/c128lib"]
13+
srcDirs = ["lib"]
14+
15+
viceExecutable = 'x128'
1316

1417
libFromGitHub "c128lib/common", "0.6.0"
1518
libFromGitHub "c128lib/chipset", "0.6.1"
19+
libFromGitHub "c128lib/128spec", "0.7.2"
1620
}

spec/sort.spec.asm

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#import "128spec/lib/128spec.asm"
2+
3+
sfspec:
4+
init_spec()
5+
6+
describe("BubbleSort")
7+
8+
it("Inverted array"); {
9+
// Arrange
10+
11+
// Act
12+
c128lib_BubbleSort(arrayInverted, arrayInvertedSize, false)
13+
14+
// Assert
15+
assert_bytes_equal arrayInvertedSize: arrayInverted: arrayOrderedChallenge
16+
}
17+
18+
it("Random array"); {
19+
// Arrange
20+
21+
// Act
22+
c128lib_BubbleSort(arrayRandom, arrayRandomSize, false)
23+
24+
// Assert
25+
assert_bytes_equal arrayRandomSize: arrayRandom: arrayOrderedChallenge
26+
}
27+
28+
it("Ordeded array"); {
29+
// Arrange
30+
31+
// Act
32+
c128lib_BubbleSort(arrayOrdered, arrayOrderedSize, false)
33+
34+
// Assert
35+
assert_bytes_equal arrayOrderedSize: arrayOrdered: arrayOrderedChallenge
36+
}
37+
38+
finish_spec()
39+
40+
* = * "Data"
41+
.label arrayInvertedSize = 10
42+
arrayInverted: .fill arrayInvertedSize, arrayInvertedSize-(i+1)
43+
44+
.label arrayRandomSize = 10
45+
arrayRandom: .byte 7, 6, 3, 5, 1, 0, 2, 4, 8, 9
46+
47+
.label arrayOrderedSize = 10
48+
arrayOrdered: .fill arrayOrderedSize, i
49+
50+
.label arrayOrderedChallengeSize = 10
51+
arrayOrderedChallenge: .fill arrayOrderedChallengeSize, i
52+
53+
.macro SetValue8Bit(variable, value) {
54+
lda #value
55+
sta variable
56+
}
57+
.macro SetValue16Bit(variable, value) {
58+
lda #<value
59+
sta variable
60+
lda #>value
61+
sta variable + 1
62+
}
63+
64+
#import "../lib/sort-global.asm"
65+

0 commit comments

Comments
 (0)