Skip to content

Commit

Permalink
Update tests collatz conjecture (#2581)
Browse files Browse the repository at this point in the history
* Updating tests collatz-conjecture

* updating proof.ci.js for collatz-conjecture
  • Loading branch information
jagdish-15 authored Jan 6, 2025
1 parent 4cb770c commit b1e9fba
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
1 change: 1 addition & 0 deletions exercises/practice/collatz-conjecture/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"authors": [],
"contributors": [
"ankorGH",
"jagdish-15",
"rchavarria",
"SleeplessByte",
"xarxziux"
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/collatz-conjecture/.meta/proof.ci.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const steps = (n) => {
if (n <= 0) {
throw new Error('Only positive numbers are allowed');
throw new Error('Only positive integers are allowed');
}

const iterate = (number, step) => {
Expand Down
23 changes: 20 additions & 3 deletions exercises/practice/collatz-conjecture/.meta/tests.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# 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.

[540a3d51-e7a6-47a5-92a3-4ad1838f0bfd]
description = "zero steps for one"
Expand All @@ -16,6 +23,16 @@ description = "large number of even and odd steps"

[7d4750e6-def9-4b86-aec7-9f7eb44f95a3]
description = "zero is an error"
include = false

[2187673d-77d6-4543-975e-66df6c50e2da]
description = "zero is an error"
reimplements = "7d4750e6-def9-4b86-aec7-9f7eb44f95a3"

[c6c795bf-a288-45e9-86a1-841359ad426d]
description = "negative value is an error"
include = false

[ec11f479-56bc-47fd-a434-bcd7a31a7a2e]
description = "negative value is an error"
reimplements = "c6c795bf-a288-45e9-86a1-841359ad426d"
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ describe('steps()', () => {
xtest('zero is an error', () => {
expect(() => {
steps(0);
}).toThrow(new Error('Only positive numbers are allowed'));
}).toThrow(new Error('Only positive integers are allowed'));
});

xtest('negative value is an error', () => {
expect(() => {
steps(-15);
}).toThrow(new Error('Only positive numbers are allowed'));
}).toThrow(new Error('Only positive integers are allowed'));
});
});

0 comments on commit b1e9fba

Please sign in to comment.