Skip to content

Commit

Permalink
add some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
brekk committed Mar 30, 2024
1 parent de673f1 commit ca0b917
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
9 changes: 9 additions & 0 deletions prelude/__internal__/Byte.spec.mad
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Byte from "./Byte"

import {test, assertEquals} from "Test"


test(
"Byte.range",
() => assertEquals(Byte.range(0_b, 6_b), [0_b, 1_b, 2_b, 3_b, 4_b, 5_b])
)
10 changes: 9 additions & 1 deletion prelude/__internal__/Float.spec.mad
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { EQ, GT, LT } from "Compare"
import { assertEquals, test } from "Test"
import { EQ, LT, GT } from "Compare"

import Float from "./Float"



test("toInteger - positive", () => assertEquals(Float.toInteger(3.4), 3))
test("toInteger - negative", () => assertEquals(Float.toInteger(-3.4), -3))

Expand All @@ -13,3 +16,8 @@ test("Compare Integer - GT", () => assertEquals(compare(3.3, 2.2), GT))
test("Compare Integer - LT", () => assertEquals(compare(1.1, 2.2), LT))

test("Compare Integer - EQ", () => assertEquals(compare(2.2, 2.2), EQ))

test(
"Float.range",
() => assertEquals(Float.range(0.0, 10.0), [0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 9.0]),
)
3 changes: 2 additions & 1 deletion prelude/__internal__/Integer.spec.mad
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { EQ, GT, LT } from "Compare"
import { range } from "Integer"
import { assertEquals, test } from "Test"

import { range } from "./Integer"



test("Compare Integer - GT", (_) => assertEquals(compare(3, 2), GT))
Expand Down
2 changes: 2 additions & 0 deletions prelude/__internal__/Short.spec.mad
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ test("Compare Integer - GT", () => assertEquals(compare((3 :: Short), 2), GT))
test("Compare Integer - LT", () => assertEquals(compare((1 :: Short), 2), LT))

test("Compare Integer - EQ", () => assertEquals(compare((2 :: Short), 2), EQ))

test("range", () => assertEquals(Short.range(0, 6), [0_s, 1_s, 2_s, 3_s, 4_s, 5_s]))

0 comments on commit ca0b917

Please sign in to comment.