Fixed an issue with the README, improved error messages

This commit is contained in:
josua 2020-09-13 16:17:53 +10:00
parent 87d916b0b4
commit a75f208b02
3 changed files with 12 additions and 32 deletions

View File

@ -252,8 +252,8 @@ for comments.
"doubleArray": double (
42.5D, -20D, 400D,
NaND, -InfinityD, InfinityD,
5.3e-200F, 4e+500F, 2.2e200F,
)
5.3e-200D, 4e+120D, 2.2e200D,
),
/*
Arrays are enclosed by an opening

View File

@ -240,7 +240,7 @@ public class BdfObject implements IBdfType
if(ptr.isNext("true"))
{
if(type != BdfTypes.ARRAY_BOOLEAN) {
throw BdfError.createError(BdfError.ERROR_SYNTAX, ptr);
throw BdfError.createError(BdfError.ERROR_SYNTAX, ptr.getPointer(-4));
}
boolean[] a = (boolean[]) array;
@ -250,7 +250,7 @@ public class BdfObject implements IBdfType
else if(ptr.isNext("false"))
{
if(type != BdfTypes.ARRAY_BOOLEAN) {
throw BdfError.createError(BdfError.ERROR_SYNTAX, ptr);
throw BdfError.createError(BdfError.ERROR_SYNTAX, ptr.getPointer(-5));
}
boolean[] a = (boolean[]) array;
@ -260,7 +260,7 @@ public class BdfObject implements IBdfType
else if(ptr.isNext("infinityd"))
{
if(type != BdfTypes.ARRAY_DOUBLE) {
throw BdfError.createError(BdfError.ERROR_SYNTAX, ptr);
throw BdfError.createError(BdfError.ERROR_SYNTAX, ptr.getPointer(-9));
}
double[] a = (double[]) array;
@ -270,7 +270,7 @@ public class BdfObject implements IBdfType
else if(ptr.isNext("-infinityd"))
{
if(type != BdfTypes.ARRAY_DOUBLE) {
throw BdfError.createError(BdfError.ERROR_SYNTAX, ptr);
throw BdfError.createError(BdfError.ERROR_SYNTAX, ptr.getPointer(-10));
}
double[] a = (double[]) array;
@ -280,7 +280,7 @@ public class BdfObject implements IBdfType
else if(ptr.isNext("nand"))
{
if(type != BdfTypes.ARRAY_DOUBLE) {
throw BdfError.createError(BdfError.ERROR_SYNTAX, ptr);
throw BdfError.createError(BdfError.ERROR_SYNTAX, ptr.getPointer(-4));
}
double[] a = (double[]) array;
@ -290,7 +290,7 @@ public class BdfObject implements IBdfType
else if(ptr.isNext("infinityf"))
{
if(type != BdfTypes.ARRAY_FLOAT) {
throw BdfError.createError(BdfError.ERROR_SYNTAX, ptr);
throw BdfError.createError(BdfError.ERROR_SYNTAX, ptr.getPointer(-9));
}
float[] a = (float[]) array;
@ -300,7 +300,7 @@ public class BdfObject implements IBdfType
else if(ptr.isNext("-infinityf"))
{
if(type != BdfTypes.ARRAY_FLOAT) {
throw BdfError.createError(BdfError.ERROR_SYNTAX, ptr);
throw BdfError.createError(BdfError.ERROR_SYNTAX, ptr.getPointer(-10));
}
float[] a = (float[]) array;
@ -310,7 +310,7 @@ public class BdfObject implements IBdfType
else if(ptr.isNext("nanf"))
{
if(type != BdfTypes.ARRAY_FLOAT) {
throw BdfError.createError(BdfError.ERROR_SYNTAX, ptr);
throw BdfError.createError(BdfError.ERROR_SYNTAX, ptr.getPointer(-4));
}
float[] a = (float[]) array;

View File

@ -5,6 +5,7 @@ import java.io.IOException;
import bdf.data.IBdfDatabase;
import bdf.types.BdfReader;
import bdf.types.BdfReaderHuman;
public class Tests
{
@ -29,28 +30,7 @@ public class Tests
public static void main(String[] args) throws IOException
{
@SuppressWarnings("resource")
FileInputStream rand = new FileInputStream("/dev/urandom");
byte[] buffer = new byte[100];
long start = System.currentTimeMillis();
long done = 0;
int i = 0;
for(;;)
{
if(System.currentTimeMillis() - start > 1000) {
System.out.println("" + i + ": " + done);
start += 1000;
done = 0;
i += 1;
}
done += 1;
rand.read(buffer);
new BdfReader(buffer);
}
new BdfReaderHuman("int(NaND)");
}
}