Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions core/math.ktt
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ Object extend: Fixnum With: {
sqrt = { (self _FixnumToFloat) sqrt }.
sin = { MathFFI sin: (self _FixnumToFloat) }.
cos = { MathFFI cos: (self _FixnumToFloat) }.
asComplex = { Complex clone setRe: self Im: 0 }.

toString = { self _FixnumToString }.
toStringRadix: r = { self _FixnumToStringRadix: r }.
Expand Down Expand Up @@ -164,6 +165,7 @@ Object extend: Bignum With: {

neg = { self _BignumNeg }.
sqrt = { (self _BignumToFloat) sqrt }.
asComplex = { Complex clone setRe: self Im: 0 }.

eqFixnum: lhs = { (lhs _FixnumToBignum) _BignumEq: self }.
neFixnum: lhs = { (lhs _FixnumToBignum) _BignumNe: self }.
Expand Down Expand Up @@ -234,6 +236,7 @@ Object extend: Ratio With: {

neg = { self _RatioNeg }.
sqrt = { (self _RatioToFloat) sqrt }.
asComplex = { Complex clone setRe: self Im: 0 }.

eqFixnum: lhs = { (lhs _FixnumToRatio) _RatioEq: self }.
neFixnum: lhs = { (lhs _FixnumToRatio) _RatioNe: self }.
Expand Down Expand Up @@ -339,6 +342,7 @@ Object extend: Float With: {
geFloat: lhs = { lhs _FloatGe: self }.

neg = { self _FloatNeg }.
asComplex = { Complex clone setRe: self Im: 0 }.
sin = { MathFFI sin: self }.
cos = { MathFFI cos: self }.
toString = { self _FloatToString }.
Expand Down
4 changes: 2 additions & 2 deletions run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
SYSTEM_INIT = "core/system.ktt"
OS_INIT = "core/os.ktt"
def build_command(debug: bool) -> list[str]:
cmd = ["cargo", "build", "--bin", "kette"]
cmd = ["cargo", "build", "--bin", "vm"]
if not debug:
cmd.append("--release")
return cmd

def run_command(debug: bool) -> list[str]:
cmd = ["cargo", "run", "--bin", "kette"]
cmd = ["cargo", "run", "--bin", "vm"]
if not debug:
cmd.append("--release")
cmd.extend([
Expand Down
3 changes: 3 additions & 0 deletions tests/disposable_using.ktt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// expect:
// disposable-using: ok

Module open: 'Test::DisposableUsing.
Module use: 'OS.

Expand Down
6 changes: 6 additions & 0 deletions tests/file_disposable.ktt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// expect:
// 9326
// 9326
// 56
// file-disposable: ok

Module open: 'Test::FileDisposable.
Module use: 'System & 'OS.

Expand Down
16 changes: 15 additions & 1 deletion tests/init_runtime_demo.ktt
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// expect:
// Reading: core/init.ktt (Size: 9326):
// VM _ModuleOpen: 'Core.
//
// 54
// incredible
// Module demo start
// 45
// 42
// 3
// 42
// Module demo end
// App

Module open: 'Test::RuntimeDemo.
Module use: 'System.
Module use: 'OS.
Expand All @@ -8,7 +22,7 @@ Module use: 'OS.
eachLine: [ | line |
line println
]
First: 3
First: 2
].

NewGlobal := None.
Expand Down
2 changes: 2 additions & 0 deletions tests/linked_list_chasing.ktt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// expect:

Module open: 'LinkedListChasing.
Module use: 'Collections.

Expand Down
17 changes: 11 additions & 6 deletions tests/mitternacht.ktt
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
// expect:
// -1 + 1i
// -1 - 1i

Module open: 'Test::Mitternacht.
Module use: 'Math.

Math = {
rootsOfA: a B: b C: c = {
Quadratic = {
printRootsOfA: a B: b C: c = {
disc = (b * b) - (4 * a * c).
sqrtDisc = disc sqrt.
denom = 2 * a.
root1 = ((0 - b) + sqrtDisc) / denom.
root2 = ((0 - b) - sqrtDisc) / denom.
{ root1. root2 }
negB = 0 - b.
((negB + sqrtDisc) / denom) toString println.
((negB - sqrtDisc) / denom) toString println.
}.
}.

res = Math rootsOfA: 1 B: 2 C: 2
Quadratic printRootsOfA: 1 B: 2 C: 2.
3 changes: 3 additions & 0 deletions tests/proxy_ctype_accessors.ktt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// expect:
// proxy-ctype-accessors: ok

Module open: 'Test::ProxyCTypeAccessors.
Module use: 'Alien & 'System.

Expand Down
3 changes: 3 additions & 0 deletions tests/proxy_ctype_nested_struct.ktt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// expect:
// proxy-ctype-nested-struct: ok

Module open: 'Test::ProxyCTypeNestedStruct.
Module use: 'Alien.

Expand Down
Loading