add test file diff.nas

This commit is contained in:
ValKmjolnir 2022-04-30 20:00:15 +08:00
parent c4b7712e53
commit f049e1f9fb
4 changed files with 10 additions and 2 deletions

View File

@ -16,6 +16,7 @@ test:nasal
@ ./nasal -op -e -d test/calc.nas @ ./nasal -op -e -d test/calc.nas
@ ./nasal -op -e test/choice.nas @ ./nasal -op -e test/choice.nas
@ ./nasal -op -e test/class.nas @ ./nasal -op -e test/class.nas
@ ./nasal -op -e test/diff.nas
-@ ./nasal -op -d test/exception.nas -@ ./nasal -op -d test/exception.nas
@ ./nasal -op -t -d test/fib.nas @ ./nasal -op -t -d test/fib.nas
@ ./nasal -op -e test/filesystem.nas @ ./nasal -op -e test/filesystem.nas

View File

@ -424,7 +424,7 @@ nasal_ref builtin_str(nasal_ref* local,nasal_gc& gc)
nasal_ref builtin_size(nasal_ref* local,nasal_gc& gc) nasal_ref builtin_size(nasal_ref* local,nasal_gc& gc)
{ {
nasal_ref val=local[1]; nasal_ref val=local[1];
double num; double num=0;
switch(val.type) switch(val.type)
{ {
case vm_num: num=val.num(); break; case vm_num: num=val.num(); break;

View File

@ -38,6 +38,7 @@ var testfile=[
"test/calc.nas ", "test/calc.nas ",
"test/choice.nas ", "test/choice.nas ",
"test/class.nas ", "test/class.nas ",
"test/diff.nas ",
"test/exception.nas ", "test/exception.nas ",
"test/fib.nas ", "test/fib.nas ",
"test/filesystem.nas ", "test/filesystem.nas ",

View File

@ -191,4 +191,10 @@ var a={
} }
}; };
println(isa(a.new(),a)); # 1 println(isa(a.new(),a)); # 1
println(isa(a.new2(),a));# 0 println(isa(a.new2(),a));# 0
var a=[10,-10,0,1,2,3,nil,"string","hello",[],[0,1,2,3],{},{a:0,b:1,c:2},func{}];
println("type\tsize\tnum\tsrc");
foreach(var i;a){
println(typeof(i),'\t',size(i),'\t',num(i),'\t',i);
}