Add back compiler unit tests
This commit is contained in:
@@ -47,7 +47,8 @@ public class LuaDouble extends LuaNumber {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return (int) Double.doubleToLongBits(v);
|
long l = Double.doubleToLongBits(v);
|
||||||
|
return ((int)(l>>32)) | (int) l;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean islong() {
|
public boolean islong() {
|
||||||
@@ -145,7 +146,7 @@ public class LuaDouble extends LuaNumber {
|
|||||||
return JSTR_NAN;
|
return JSTR_NAN;
|
||||||
if ( Double.isInfinite(v) )
|
if ( Double.isInfinite(v) )
|
||||||
return (v<0? JSTR_NEGINF: JSTR_POSINF);
|
return (v<0? JSTR_NEGINF: JSTR_POSINF);
|
||||||
return Double.toString(v);
|
return Float.toString((float)v);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LuaString strvalue() {
|
public LuaString strvalue() {
|
||||||
|
|||||||
@@ -26,6 +26,10 @@ import junit.framework.TestSuite;
|
|||||||
|
|
||||||
import org.luaj.vm2.WeakTableTest.WeakKeyTableTest;
|
import org.luaj.vm2.WeakTableTest.WeakKeyTableTest;
|
||||||
import org.luaj.vm2.WeakTableTest.WeakKeyValueTableTest;
|
import org.luaj.vm2.WeakTableTest.WeakKeyValueTableTest;
|
||||||
|
import org.luaj.vm2.compiler.CompilerUnitTests;
|
||||||
|
import org.luaj.vm2.compiler.DumpLoadEndianIntTest;
|
||||||
|
import org.luaj.vm2.compiler.RegressionTests;
|
||||||
|
import org.luaj.vm2.compiler.SimpleTests;
|
||||||
import org.luaj.vm2.lib.jse.LuaJavaCoercionTest;
|
import org.luaj.vm2.lib.jse.LuaJavaCoercionTest;
|
||||||
import org.luaj.vm2.vm1.Luajvm1CompatibilityTest;
|
import org.luaj.vm2.vm1.Luajvm1CompatibilityTest;
|
||||||
|
|
||||||
@@ -52,6 +56,14 @@ public class AllTests {
|
|||||||
table.addTestSuite(WeakKeyValueTableTest.class);
|
table.addTestSuite(WeakKeyValueTableTest.class);
|
||||||
suite.addTest(table);
|
suite.addTest(table);
|
||||||
|
|
||||||
|
// prototype compiler
|
||||||
|
TestSuite compiler = new TestSuite("Lua Compiler Tests");
|
||||||
|
compiler.addTestSuite(CompilerUnitTests.class);
|
||||||
|
compiler.addTestSuite(DumpLoadEndianIntTest.class);
|
||||||
|
compiler.addTestSuite(RegressionTests.class);
|
||||||
|
compiler.addTestSuite(SimpleTests.class);
|
||||||
|
suite.addTest(compiler);
|
||||||
|
|
||||||
// library tests
|
// library tests
|
||||||
TestSuite lib = new TestSuite("Library Tests");
|
TestSuite lib = new TestSuite("Library Tests");
|
||||||
lib.addTestSuite(LuaJavaCoercionTest.class);
|
lib.addTestSuite(LuaJavaCoercionTest.class);
|
||||||
@@ -62,7 +74,7 @@ public class AllTests {
|
|||||||
suite.addTestSuite(Luajvm1CompatibilityTest.class);
|
suite.addTestSuite(Luajvm1CompatibilityTest.class);
|
||||||
|
|
||||||
// luajc regression tests
|
// luajc regression tests
|
||||||
TestSuite luajc = new TestSuite("Luajc Tests");
|
TestSuite luajc = new TestSuite("Java Compiler Tests");
|
||||||
luajc.addTestSuite(FragmentsTest.class);
|
luajc.addTestSuite(FragmentsTest.class);
|
||||||
suite.addTest(luajc);
|
suite.addTest(luajc);
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ abstract public class AbstractUnitTests extends TestCase {
|
|||||||
|
|
||||||
// compile in memory
|
// compile in memory
|
||||||
InputStream is = new ByteArrayInputStream(lua);
|
InputStream is = new ByteArrayInputStream(lua);
|
||||||
Prototype p = LuaC.compile(is, dir + "/" + file);
|
Prototype p = LuaC.compile(is, "@" + dir + "/" + file);
|
||||||
String actual = protoToString(p);
|
String actual = protoToString(p);
|
||||||
|
|
||||||
// load expected value from jar
|
// load expected value from jar
|
||||||
|
|||||||
Reference in New Issue
Block a user