-
-
Notifications
You must be signed in to change notification settings - Fork 159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
difference-of-squares: Sync tests #696
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 19 additions & 12 deletions
31
exercises/practice/difference-of-squares/.meta/tests.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,37 @@ | ||
# This is an auto-generated file. Regular comments will be removed when this | ||
# file is regenerated. Regenerating will not touch any manually added keys, | ||
# so comments can be added in a "comment" key. | ||
# This is an auto-generated file. | ||
# | ||
# Regenerating this file via `configlet sync` will: | ||
# - Recreate every `description` key/value pair | ||
# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications | ||
# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion) | ||
# - Preserve any other key/value pair | ||
# | ||
# As user-added comments (using the # character) will be removed when this file | ||
# is regenerated, comments can be added via a `comment` key. | ||
|
||
[e46c542b-31fc-4506-bcae-6b62b3268537] | ||
description = "square of sum 1" | ||
description = "Square the sum of the numbers up to the given number -> square of sum 1" | ||
|
||
[9b3f96cb-638d-41ee-99b7-b4f9c0622948] | ||
description = "square of sum 5" | ||
description = "Square the sum of the numbers up to the given number -> square of sum 5" | ||
|
||
[54ba043f-3c35-4d43-86ff-3a41625d5e86] | ||
description = "square of sum 100" | ||
description = "Square the sum of the numbers up to the given number -> square of sum 100" | ||
|
||
[01d84507-b03e-4238-9395-dd61d03074b5] | ||
description = "sum of squares 1" | ||
description = "Sum the squares of the numbers up to the given number -> sum of squares 1" | ||
|
||
[c93900cd-8cc2-4ca4-917b-dd3027023499] | ||
description = "sum of squares 5" | ||
description = "Sum the squares of the numbers up to the given number -> sum of squares 5" | ||
|
||
[94807386-73e4-4d9e-8dec-69eb135b19e4] | ||
description = "sum of squares 100" | ||
description = "Sum the squares of the numbers up to the given number -> sum of squares 100" | ||
|
||
[44f72ae6-31a7-437f-858d-2c0837adabb6] | ||
description = "difference of squares 1" | ||
description = "Subtract sum of squares from square of sums -> difference of squares 1" | ||
|
||
[005cb2bf-a0c8-46f3-ae25-924029f8b00b] | ||
description = "difference of squares 5" | ||
description = "Subtract sum of squares from square of sums -> difference of squares 5" | ||
|
||
[b1bf19de-9a16-41c0-a62b-1f02ecc0b036] | ||
description = "difference of squares 100" | ||
description = "Subtract sum of squares from square of sums -> difference of squares 100" |
24 changes: 15 additions & 9 deletions
24
exercises/practice/difference-of-squares/src/difference_of_squares.clj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,19 @@ | ||
(ns difference-of-squares) | ||
|
||
(defn difference [] ;; <- arglist goes here | ||
;; your code goes here | ||
) | ||
(defn square-of-sum | ||
"Returns the square of the sum of the numbers up to the given number" | ||
[n] | ||
;; function body | ||
) | ||
|
||
(defn sum-of-squares [] ;; <- arglist goes here | ||
;; your code goes here | ||
) | ||
(defn sum-of-squares | ||
"Returns the sum of the squares of the numbers up to the given number" | ||
[n] | ||
;; function body | ||
) | ||
|
||
(defn square-of-sum [] ;; <- arglist goes here | ||
;; your code goes here | ||
) | ||
(defn difference | ||
"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" | ||
[n] | ||
;; function body | ||
) |
49 changes: 29 additions & 20 deletions
49
exercises/practice/difference-of-squares/test/difference_of_squares_test.clj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,39 @@ | ||
(ns difference-of-squares-test | ||
(:require [clojure.test :refer [deftest is]] | ||
[difference-of-squares :as dos])) | ||
(:require [clojure.test :refer [deftest testing is]] | ||
difference-of-squares)) | ||
|
||
(deftest square-of-sum-to-5 | ||
(is (= 225 (dos/square-of-sum 5)))) | ||
(deftest square-of-sum_test_1 | ||
(testing "Square the sum of the numbers up to the given number -> square of sum 1" | ||
(is (= 1 (difference-of-squares/square-of-sum 1))))) | ||
|
||
(deftest sum-of-squares-to-5 | ||
(is (= 55 (dos/sum-of-squares 5)))) | ||
(deftest square-of-sum_test_2 | ||
(testing "Square the sum of the numbers up to the given number -> square of sum 5" | ||
(is (= 225 (difference-of-squares/square-of-sum 5))))) | ||
|
||
(deftest difference-of-squares-to-5 | ||
(is (= 170 (dos/difference 5)))) | ||
(deftest square-of-sum_test_3 | ||
(testing "Square the sum of the numbers up to the given number -> square of sum 100" | ||
(is (= 25502500 (difference-of-squares/square-of-sum 100))))) | ||
|
||
(deftest square-of-sum-to-10 | ||
(is (= 3025 (dos/square-of-sum 10)))) | ||
(deftest sum-of-squares_test_1 | ||
(testing "Sum the squares of the numbers up to the given number -> sum of squares 1" | ||
(is (= 1 (difference-of-squares/sum-of-squares 1))))) | ||
|
||
(deftest sum-of-squares-to-10 | ||
(is (= 385 (dos/sum-of-squares 10)))) | ||
(deftest sum-of-squares_test_2 | ||
(testing "Sum the squares of the numbers up to the given number -> sum of squares 5" | ||
(is (= 55 (difference-of-squares/sum-of-squares 5))))) | ||
|
||
(deftest difference-of-squares-to-10 | ||
(is (= 2640 (dos/difference 10)))) | ||
(deftest sum-of-squares_test_3 | ||
(testing "Sum the squares of the numbers up to the given number -> sum of squares 100" | ||
(is (= 338350 (difference-of-squares/sum-of-squares 100))))) | ||
|
||
(deftest square-of-sum-to-100 | ||
(is (= 25502500 (dos/square-of-sum 100)))) | ||
(deftest difference_test_1 | ||
(testing "Subtract sum of squares from square of sums -> difference of squares 1" | ||
(is (= 0 (difference-of-squares/difference 1))))) | ||
|
||
(deftest sum-of-squares-to-100 | ||
(is (= 338350 (dos/sum-of-squares 100)))) | ||
(deftest difference_test_2 | ||
(testing "Subtract sum of squares from square of sums -> difference of squares 5" | ||
(is (= 170 (difference-of-squares/difference 5))))) | ||
|
||
(deftest difference-of-squares-to-100 | ||
(is (= 25164150 (dos/difference 100)))) | ||
(deftest difference_test_3 | ||
(testing "Subtract sum of squares from square of sums -> difference of squares 100" | ||
(is (= 25164150 (difference-of-squares/difference 100))))) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love that you moved this to the bottom
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love that you also did the same 😄