Skip to content

Commit

Permalink
Added some more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
stanhebben committed Feb 23, 2024
1 parent 8e3526d commit 768f1f8
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.openzen.zenscript.codemodel.type.builtin;

import com.sun.org.apache.xpath.internal.operations.Mod;
import org.openzen.zenscript.codemodel.FunctionHeader;
import org.openzen.zenscript.codemodel.FunctionParameter;
import org.openzen.zenscript.codemodel.Modifiers;
Expand Down Expand Up @@ -346,7 +345,6 @@ public enum BuiltinMethodSymbol implements MethodSymbol {
USIZE_SHL(USIZE, SHL, USIZE, USIZE),
USIZE_SHR(USIZE, SHR, USIZE, USIZE),
USIZE_COMPARE(USIZE, COMPARE, INT, USIZE),
USIZE_COMPARE_UINT(USIZE, COMPARE, INT, UINT),
USIZE_TO_BYTE(USIZE, MethodID.caster(BYTE), Modifiers.NONE, BYTE),
USIZE_TO_SBYTE(USIZE, MethodID.caster(SBYTE), Modifiers.NONE, SBYTE),
USIZE_TO_SHORT(USIZE, MethodID.caster(SHORT), Modifiers.NONE, SHORT),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#output: Two is Foo
#output: Two is int

alias Foo as int;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

val byteValue = 1 as byte;
val sbyteValue = 2 as sbyte;
val shortValue = 3 as short;
val ushortValue = 4 as ushort;
val intValue = 5 as int;
val uintValue = 6 as uint;
val longValue = 7 as long;
val ulongValue = 8 as ulong;
val usizeValue = 9 as usize;

println(typeof(byteValue + sbyteValue));
println(byteValue + sbyteValue);
println(typeof(byteValue + shortValue));
println(byteValue + shortValue);
println(typeof(sbyteValue + ushortValue));
println(byteValue + ushortValue);
println(typeof(byteValue + intValue));
println(byteValue + intValue);
println(typeof(sbyteValue + uintValue));
println(byteValue + uintValue);
println(typeof(byteValue + longValue));
println(byteValue + longValue);
println(typeof(sbyteValue + ulongValue));
println(byteValue + ulongValue);
println(typeof(byteValue + usizeValue));
println(byteValue + usizeValue);
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,25 @@ val usizeValue = 9 as usize;
val floatValue = 10 as float;
val doubleValue = 11 as double;

println(typeof(byteValue + byteValue));
/*println(typeof(byteValue + byteValue));
println(byteValue + byteValue);
/*println(typeof(byteValue + sbyteValue));
println(byteValue + sbyteValue);
println(typeof(byteValue + shortValue));
println(byteValue + shortValue);
println(typeof(sbyteValue + sbyteValue));
println(sbyteValue + sbyteValue);
println(typeof(sbyteValue + shortValue));
println(sbyteValue + shortValue);
println(typeof(byteValue + ushortValue));
println(byteValue + ushortValue);
println(typeof(byteValue + intValue));
println(byteValue + intValue);
println(typeof(sbyteValue + intValue));
println(sbyteValue + intValue);
println(typeof(byteValue + uintValue));
println(byteValue + uintValue);
println(typeof(byteValue + longValue));
println(byteValue + longValue);
println(typeof(sbyteValue + longValue));
println(sbyteValue + longValue);
println(typeof(byteValue + ulongValue));
println(byteValue + ulongValue);
println(typeof(byteValue + usizeValue));
println(byteValue + usizeValue);
println(typeof(byteValue + floatValue));
println(byteValue + floatValue);
println(byteValue + floatValue);*/
println(typeof(byteValue + doubleValue));
println(byteValue + doubleValue);*/
println(byteValue + doubleValue);
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#output: Undetermined

//Should this error?

function println(a as string) {

}

println("Hello");
println("Hello");
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#output: 254

println(~(1 as byte));
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#output: false
#output: false
#output: false

val result = !true;
println(result);
println(!true);
println((!true) as string);

0 comments on commit 768f1f8

Please sign in to comment.