Skip to content

Commit f0192a5

Browse files
authored
difference-of-squares: Sync tests (#696)
* sync tests * implement tests * update starter file * update config * rename test functions [no important files changed]
1 parent 6f6fd12 commit f0192a5

File tree

4 files changed

+65
-42
lines changed

4 files changed

+65
-42
lines changed

exercises/practice/difference-of-squares/.meta/config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"mathias",
1212
"rubysolo",
1313
"Scientifica96",
14-
"yurrriq"
14+
"yurrriq",
15+
"tasxatzial"
1516
],
1617
"files": {
1718
"solution": [
Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,37 @@
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
[e46c542b-31fc-4506-bcae-6b62b3268537]
6-
description = "square of sum 1"
13+
description = "Square the sum of the numbers up to the given number -> square of sum 1"
714

815
[9b3f96cb-638d-41ee-99b7-b4f9c0622948]
9-
description = "square of sum 5"
16+
description = "Square the sum of the numbers up to the given number -> square of sum 5"
1017

1118
[54ba043f-3c35-4d43-86ff-3a41625d5e86]
12-
description = "square of sum 100"
19+
description = "Square the sum of the numbers up to the given number -> square of sum 100"
1320

1421
[01d84507-b03e-4238-9395-dd61d03074b5]
15-
description = "sum of squares 1"
22+
description = "Sum the squares of the numbers up to the given number -> sum of squares 1"
1623

1724
[c93900cd-8cc2-4ca4-917b-dd3027023499]
18-
description = "sum of squares 5"
25+
description = "Sum the squares of the numbers up to the given number -> sum of squares 5"
1926

2027
[94807386-73e4-4d9e-8dec-69eb135b19e4]
21-
description = "sum of squares 100"
28+
description = "Sum the squares of the numbers up to the given number -> sum of squares 100"
2229

2330
[44f72ae6-31a7-437f-858d-2c0837adabb6]
24-
description = "difference of squares 1"
31+
description = "Subtract sum of squares from square of sums -> difference of squares 1"
2532

2633
[005cb2bf-a0c8-46f3-ae25-924029f8b00b]
27-
description = "difference of squares 5"
34+
description = "Subtract sum of squares from square of sums -> difference of squares 5"
2835

2936
[b1bf19de-9a16-41c0-a62b-1f02ecc0b036]
30-
description = "difference of squares 100"
37+
description = "Subtract sum of squares from square of sums -> difference of squares 100"
Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
(ns difference-of-squares)
22

3-
(defn difference [] ;; <- arglist goes here
4-
;; your code goes here
5-
)
3+
(defn square-of-sum
4+
"Returns the square of the sum of the numbers up to the given number"
5+
[n]
6+
;; function body
7+
)
68

7-
(defn sum-of-squares [] ;; <- arglist goes here
8-
;; your code goes here
9-
)
9+
(defn sum-of-squares
10+
"Returns the sum of the squares of the numbers up to the given number"
11+
[n]
12+
;; function body
13+
)
1014

11-
(defn square-of-sum [] ;; <- arglist goes here
12-
;; your code goes here
13-
)
15+
(defn difference
16+
"Returns the difference between the square of the sum of numbers up to a given number and the sum of the squares of those numbers"
17+
[n]
18+
;; function body
19+
)
Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,39 @@
11
(ns difference-of-squares-test
2-
(:require [clojure.test :refer [deftest is]]
3-
[difference-of-squares :as dos]))
2+
(:require [clojure.test :refer [deftest testing is]]
3+
difference-of-squares))
44

5-
(deftest square-of-sum-to-5
6-
(is (= 225 (dos/square-of-sum 5))))
5+
(deftest square-of-sum_test_1
6+
(testing "Square the sum of the numbers up to the given number -> square of sum 1"
7+
(is (= 1 (difference-of-squares/square-of-sum 1)))))
78

8-
(deftest sum-of-squares-to-5
9-
(is (= 55 (dos/sum-of-squares 5))))
9+
(deftest square-of-sum_test_2
10+
(testing "Square the sum of the numbers up to the given number -> square of sum 5"
11+
(is (= 225 (difference-of-squares/square-of-sum 5)))))
1012

11-
(deftest difference-of-squares-to-5
12-
(is (= 170 (dos/difference 5))))
13+
(deftest square-of-sum_test_3
14+
(testing "Square the sum of the numbers up to the given number -> square of sum 100"
15+
(is (= 25502500 (difference-of-squares/square-of-sum 100)))))
1316

14-
(deftest square-of-sum-to-10
15-
(is (= 3025 (dos/square-of-sum 10))))
17+
(deftest sum-of-squares_test_1
18+
(testing "Sum the squares of the numbers up to the given number -> sum of squares 1"
19+
(is (= 1 (difference-of-squares/sum-of-squares 1)))))
1620

17-
(deftest sum-of-squares-to-10
18-
(is (= 385 (dos/sum-of-squares 10))))
21+
(deftest sum-of-squares_test_2
22+
(testing "Sum the squares of the numbers up to the given number -> sum of squares 5"
23+
(is (= 55 (difference-of-squares/sum-of-squares 5)))))
1924

20-
(deftest difference-of-squares-to-10
21-
(is (= 2640 (dos/difference 10))))
25+
(deftest sum-of-squares_test_3
26+
(testing "Sum the squares of the numbers up to the given number -> sum of squares 100"
27+
(is (= 338350 (difference-of-squares/sum-of-squares 100)))))
2228

23-
(deftest square-of-sum-to-100
24-
(is (= 25502500 (dos/square-of-sum 100))))
29+
(deftest difference_test_1
30+
(testing "Subtract sum of squares from square of sums -> difference of squares 1"
31+
(is (= 0 (difference-of-squares/difference 1)))))
2532

26-
(deftest sum-of-squares-to-100
27-
(is (= 338350 (dos/sum-of-squares 100))))
33+
(deftest difference_test_2
34+
(testing "Subtract sum of squares from square of sums -> difference of squares 5"
35+
(is (= 170 (difference-of-squares/difference 5)))))
2836

29-
(deftest difference-of-squares-to-100
30-
(is (= 25164150 (dos/difference 100))))
37+
(deftest difference_test_3
38+
(testing "Subtract sum of squares from square of sums -> difference of squares 100"
39+
(is (= 25164150 (difference-of-squares/difference 100)))))

0 commit comments

Comments
 (0)