Add back compiler unit tests

This commit is contained in:
James Roseborough
2010-04-26 14:08:36 +00:00
parent 23434069c8
commit 770261d65c
3 changed files with 17 additions and 4 deletions

View File

@@ -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() {

View File

@@ -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);

View File

@@ -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