-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add four more tests, fix invalid (yet unused) operator and for member…
…s define the last comparator for
- Loading branch information
1 parent
299e85f
commit 2ca88eb
Showing
6 changed files
with
72 additions
and
3 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
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
17 changes: 17 additions & 0 deletions
17
ScriptingEngineTester/src/main/resources/zencode-tests/classes/collision-1.zc
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#output: 3 | ||
#output: 3 | ||
|
||
public class Collision { | ||
public static min(a as int, b as int) as int { | ||
return a < b ? a : b; | ||
} | ||
public static min(a as double, b as double) as double { | ||
return a < b ? a : b; | ||
} | ||
public static min(a as usize, b as usize) as usize { | ||
return a < b ? a : b; | ||
} | ||
} | ||
|
||
println("" + Collision.min(3, 5)); | ||
println("" + Collision.min(5, 3)); |
16 changes: 16 additions & 0 deletions
16
ScriptingEngineTester/src/main/resources/zencode-tests/classes/collision-2.zc
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#output: Hello Collision! | ||
#output: Hello World! | ||
|
||
public class Collision { | ||
public this() {} | ||
|
||
public print_collision() as void { | ||
println("Hello World!"); | ||
} | ||
public static print_collision() as void { | ||
println("Hello Collision!"); | ||
} | ||
} | ||
|
||
Collision.print_collision(); | ||
new Collision().print_collision(); |
17 changes: 17 additions & 0 deletions
17
ScriptingEngineTester/src/main/resources/zencode-tests/classes/collision-3.zc
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#output: 4 | ||
|
||
public class Collision { | ||
private val min as int; | ||
|
||
public this(a as int) { | ||
this.min = a; | ||
} | ||
|
||
public min(min as int) as int { | ||
return min < this.min ? min : this.min; | ||
} | ||
} | ||
|
||
val min = new Collision(5); | ||
println("" + min.min(4)); | ||
|
19 changes: 19 additions & 0 deletions
19
ScriptingEngineTester/src/main/resources/zencode-tests/classes/collision-4.zc
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#output: int | ||
#output: 4 | ||
|
||
public class min { | ||
private val min as int; | ||
|
||
public this(a as int) { | ||
this.min = a; | ||
} | ||
|
||
public min(min as int) as int { | ||
println(typeof(this.min)); | ||
return min < this.min ? min : this.min; | ||
} | ||
} | ||
|
||
val min = new min(5); | ||
println("" + min.min(4)); | ||
|