Skip to content

Commit 6e1f0b0

Browse files
authored
gigasecond: Sync tests (#699)
* update starter file * sync tests * implement tests * rename test functions, make test descriptions identical to the ones from .toml [no important files changed]
1 parent f05dae6 commit 6e1f0b0

File tree

3 files changed

+35
-16
lines changed

3 files changed

+35
-16
lines changed

exercises/practice/gigasecond/.meta/tests.toml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
1-
# This is an auto-generated file. Regular comments will be removed when this
2-
# file is regenerated. Regenerating will not touch any manually added keys,
3-
# so comments can be added in a "comment" key.
1+
# This is an auto-generated file.
2+
#
3+
# Regenerating this file via `configlet sync` will:
4+
# - Recreate every `description` key/value pair
5+
# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications
6+
# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion)
7+
# - Preserve any other key/value pair
8+
#
9+
# As user-added comments (using the # character) will be removed when this file
10+
# is regenerated, comments can be added via a `comment` key.
411

512
[92fbe71c-ea52-4fac-bd77-be38023cacf7]
613
description = "date only specification of time"
@@ -13,6 +20,11 @@ description = "third test for date only specification of time"
1320

1421
[c9d89a7d-06f8-4e28-a305-64f1b2abc693]
1522
description = "full time specified"
23+
include = false
1624

1725
[09d4e30e-728a-4b52-9005-be44a58d9eba]
1826
description = "full time with day roll-over"
27+
include = false
28+
29+
[fcec307c-7529-49ab-b0fe-20309197618a]
30+
description = "does not mutate the input"
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
(ns gigasecond)
22

3-
(defn from [] ;; <- arglist goes here
4-
;; your code goes here
5-
)
3+
(defn from
4+
"Determines the date one gigasecond after the given date"
5+
[date]
6+
;; function body
7+
)
Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
(ns gigasecond-test
2-
(:require [clojure.test :refer [deftest is]]
2+
(:require [clojure.test :refer [deftest testing is]]
33
gigasecond))
44

5-
(deftest from-apr-25-2011
6-
(is (= [2043 1 1] (gigasecond/from 2011 4 25))))
5+
(deftest from_test_1
6+
(testing "date-only specification of time"
7+
(is (= [2043 1 1] (gigasecond/from 2011 4 25)))))
78

8-
(deftest from-jun-13-1977
9-
(is (= [2009 2 19] (gigasecond/from 1977 6 13))))
9+
(deftest from_test_2
10+
(testing "second test for date-only specification of time"
11+
(is (= [2009 2 19] (gigasecond/from 1977 6 13)))))
1012

11-
(deftest from-jul-19-1959
12-
(is (= [1991 3 27] (gigasecond/from 1959 7 19))))
13+
(deftest from_test_3
14+
(testing "third test for date-only specification of time"
15+
(is (= [1991 3 27] (gigasecond/from 1959 7 19)))))
1316

14-
;; customize this to test your birthday and find your gigasecond date:
15-
;; (deftest your-birthday
16-
;; (is (= [year2 month2 day2] (gigasecond/from year1 month1 day1))))
17+
(deftest from_test_4
18+
(testing "does not mutate the input"
19+
(let [date [1959 7 19]
20+
new-date (apply gigasecond/from date)]
21+
(is (= [1959 7 19] date)))))

0 commit comments

Comments
 (0)