|
|
@@ -28,6 +28,77 @@ Deno.test("Prime class", async (t) => {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
+ await t.step("static method list()", async (t) => {
|
|
|
+ await t.step("returns the list of prime numbers", () => {
|
|
|
+ assertEquals(Prime.list(20), [
|
|
|
+ 2,
|
|
|
+ 3,
|
|
|
+ 5,
|
|
|
+ 7,
|
|
|
+ 11,
|
|
|
+ 13,
|
|
|
+ 17,
|
|
|
+ 19,
|
|
|
+ ]);
|
|
|
+
|
|
|
+ assertEquals(Prime.list(200), [
|
|
|
+ 2,
|
|
|
+ 3,
|
|
|
+ 5,
|
|
|
+ 7,
|
|
|
+ 11,
|
|
|
+ 13,
|
|
|
+ 17,
|
|
|
+ 19,
|
|
|
+ 23,
|
|
|
+ 29,
|
|
|
+ 31,
|
|
|
+ 37,
|
|
|
+ 41,
|
|
|
+ 43,
|
|
|
+ 47,
|
|
|
+ 53,
|
|
|
+ 59,
|
|
|
+ 61,
|
|
|
+ 67,
|
|
|
+ 71,
|
|
|
+ 73,
|
|
|
+ 79,
|
|
|
+ 83,
|
|
|
+ 89,
|
|
|
+ 97,
|
|
|
+ 101,
|
|
|
+ 103,
|
|
|
+ 107,
|
|
|
+ 109,
|
|
|
+ 113,
|
|
|
+ 127,
|
|
|
+ 131,
|
|
|
+ 137,
|
|
|
+ 139,
|
|
|
+ 149,
|
|
|
+ 151,
|
|
|
+ 157,
|
|
|
+ 163,
|
|
|
+ 167,
|
|
|
+ 173,
|
|
|
+ 179,
|
|
|
+ 181,
|
|
|
+ 191,
|
|
|
+ 193,
|
|
|
+ 197,
|
|
|
+ 199,
|
|
|
+ ]);
|
|
|
+
|
|
|
+ assertEquals(Prime.list(10), [
|
|
|
+ 2,
|
|
|
+ 3,
|
|
|
+ 5,
|
|
|
+ 7,
|
|
|
+ ]);
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
await t.step("static method isGood()", async (t) => {
|
|
|
await t.step("validate good prime numbers (the deep version)", () => {
|
|
|
[
|
|
|
@@ -80,7 +151,7 @@ Deno.test("Prime class", async (t) => {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- await t.step("validate non-prime numbers", () => {
|
|
|
+ await t.step("validate non-good-prime numbers", () => {
|
|
|
[1, 4, 6, 8, 9, 10, 15, 79, 137].forEach((number) => {
|
|
|
assert(!Prime.isGood(number), `${number} is NOT a good prime`);
|
|
|
});
|
|
|
@@ -183,21 +254,10 @@ Deno.test("Prime class", async (t) => {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- await t.step("validate non-prime numbers", () => {
|
|
|
+ await t.step("validate non-weak-good-prime numbers", () => {
|
|
|
[1, 4, 6, 8, 9, 10, 15, 978, 999, 1000].forEach((number) => {
|
|
|
assert(!Prime.isGood(number), `${number} is NOT a weak good prime`);
|
|
|
});
|
|
|
});
|
|
|
});
|
|
|
-
|
|
|
- await t.step("static method list()", async (t) => {
|
|
|
- await t.step("returns the list of prime numbers", () => {
|
|
|
- assertEquals(Prime.list(10), [
|
|
|
- 2,
|
|
|
- 3,
|
|
|
- 5,
|
|
|
- 7,
|
|
|
- ]);
|
|
|
- });
|
|
|
- });
|
|
|
});
|