-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Bao Zhiyuan
committed
Nov 14, 2023
1 parent
2e2f81c
commit e29983c
Showing
38 changed files
with
195 additions
and
195 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
pub func assert_eq[T : Compare + Show](left : T, right : T) { | ||
pub fn assert_eq[T : Compare + Show](left : T, right : T) { | ||
if left.compare(right) != 0 { | ||
abort("assertion failed: (left == right)\n" + "left: " + left.to_string() + "\n" + "right: " + right.to_string() + "\n") | ||
} | ||
} | ||
|
||
pub func assert(x : Bool) { | ||
pub fn assert(x : Bool) { | ||
if x != true { | ||
abort("assertion failed: " + x.to_string() + "\n") | ||
} | ||
} | ||
|
||
pub func assert_ne[T : Compare + Show](left : T, right : T) { | ||
pub fn assert_ne[T : Compare + Show](left : T, right : T) { | ||
if left.compare(right) == 0 { | ||
abort("assertion failed: (left != right)\n" + "left: " + left.to_string() + "\n" + "right: " + right.to_string() + "\n") | ||
} | ||
} | ||
|
||
func init { | ||
fn init { | ||
() | ||
} | ||
|
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,4 +1,4 @@ | ||
func init { | ||
fn init { | ||
@lib.assert_eq(1, 2) // abort | ||
} | ||
|
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
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
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
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
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
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,4 +1,4 @@ | ||
func init { | ||
fn init { | ||
let buf = @lib.Buffer::new(4) | ||
buf.append_int(256) | ||
buf.append_int(255) | ||
|
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,3 +1,3 @@ | ||
pub func add(a:Int, b:Int) -> Int { | ||
pub fn add(a:Int, b:Int) -> Int { | ||
return a + b + 100 | ||
} |
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,3 +1,3 @@ | ||
func init { | ||
fn init { | ||
|
||
} |
Oops, something went wrong.