File tree 8 files changed +51
-12
lines changed
8 files changed +51
-12
lines changed Original file line number Diff line number Diff line change 2
2
. * .swp
3
3
* .cabal
4
4
stack.yaml
5
- tests /* /node_modules /
6
- tests /* /bower_components /
5
+ tests /* /node_modules
6
+ tests /* /bower_components
7
7
tests /* /.pulp-cache /
8
8
tests /* /output /
9
9
tests /* /results.json
Original file line number Diff line number Diff line change @@ -8,14 +8,16 @@ RUN apt-get update && \
8
8
9
9
WORKDIR /opt/test-runner
10
10
11
- # Pre-install packages
12
- COPY package.json package-lock.json ./
11
+ ENV PATH="/opt/test-runner/node_modules/.bin:$PATH"
12
+
13
+ COPY pre-compiled/package.json pre-compiled/package-lock.json ./
13
14
RUN npm install
14
15
15
- COPY bower.json .
16
- RUN ./node_modules/.bin/ bower install --allow-root
16
+ COPY pre-compiled/ bower.json .
17
+ RUN bower install --allow-root
17
18
18
- # TODO: pre-compile standard library and copy output directory in run.sh
19
+ COPY pre-compiled/ .
20
+ RUN pulp build
19
21
20
22
COPY . .
21
23
ENTRYPOINT ["/opt/test-runner/bin/run.sh" ]
Original file line number Diff line number Diff line change @@ -34,11 +34,9 @@ echo "${slug}: testing..."
34
34
35
35
pushd " ${input_dir} " > /dev/null
36
36
37
- cp -r " ${root_dir} /node_modules" .
38
- cp -r " ${root_dir} /bower_components" .
39
-
40
- # Required to have pulp find the `purs` executable
41
- export PATH=" ./node_modules/.bin:$PATH "
37
+ ln -s " ${root_dir} /node_modules"
38
+ ln -s " ${root_dir} /bower_components"
39
+ cp -r " ${root_dir} /output" . # We can't symlink this as pulp needs to write to it
42
40
43
41
# Run the tests for the provided implementation file and redirect stdout and
44
42
# stderr to capture it
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
1
+ module Leap where
2
+
3
+ import Prelude
4
+
5
+ isLeapYear :: Int -> Boolean
6
+ isLeapYear year =
7
+ mod year 4 == 0 &&
8
+ mod year 100 /= 0 ||
9
+ mod year 400 == 0
Original file line number Diff line number Diff line change
1
+ module Test.Main where
2
+
3
+ import Prelude
4
+
5
+ import Effect (Effect )
6
+ import Test.Unit (TestSuite , suite , test )
7
+ import Test.Unit.Main (runTest )
8
+ import Test.Unit.Assert as Assert
9
+ import Leap as Leap
10
+
11
+ main :: Effect Unit
12
+ main = runTest suites
13
+
14
+ suites :: TestSuite
15
+ suites = do
16
+ suite " Leap.isLeapYear" do
17
+ test " leap year" do
18
+ Assert .equal true $ Leap .isLeapYear 1996
19
+ test " non-leap year" do
20
+ Assert .equal false $ Leap .isLeapYear 1997
21
+ test " non-leap even year" do
22
+ Assert .equal false $ Leap .isLeapYear 1998
23
+ test " century" do
24
+ Assert .equal false $ Leap .isLeapYear 1900
25
+ test " second century" do
26
+ Assert .equal false $ Leap .isLeapYear 1800
27
+ test " fourth century" do
28
+ Assert .equal true $ Leap .isLeapYear 2400
29
+ test " y2k" do
30
+ Assert .equal true $ Leap .isLeapYear 2000
You can’t perform that action at this time.
0 commit comments