forked from xxq250/Nasal-Interpreter
⚡ visual update
This commit is contained in:
+44
-53
@@ -1,80 +1,66 @@
|
||||
import.test.md5;
|
||||
import.stl.process_bar;
|
||||
import.stl.file;
|
||||
srand();
|
||||
|
||||
var compare=func(){
|
||||
var compare=func() {
|
||||
var ch=[
|
||||
"0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","+",
|
||||
"_","*","/","\'","\"",".",",",";",":","<",">","!","@","#","$","%",
|
||||
"^","&","*","(",")","-","=","\\","|","[","]","{","}","`"," ","\t","?"
|
||||
];
|
||||
return func(begin,end){
|
||||
return func(begin,end) {
|
||||
var byte=0;
|
||||
var total=end-begin;
|
||||
var timestamp=maketimestamp();
|
||||
timestamp.stamp();
|
||||
var bar=process_bar.high_resolution_bar(40);
|
||||
for(var i=begin;i<end;i+=1){
|
||||
for(var i=begin;i<end;i+=1) {
|
||||
var s="";
|
||||
for(var j=0;j<i;j+=1){
|
||||
for(var j=0;j<i;j+=1) {
|
||||
s~=ch[rand()*size(ch)];
|
||||
}
|
||||
byte+=size(s);
|
||||
var res=md5(s);
|
||||
if(cmp(res,_md5(s))){
|
||||
if(cmp(res,_md5(s))) {
|
||||
die("error: "~str(i));
|
||||
}
|
||||
print(" ",bar.bar((i-begin+1)/total)," (",i-begin+1,"/",total,")\t",res," byte: ",int(byte/1024),"k time: ",timestamp.elapsedMSec()," \r");
|
||||
if (i-begin-int((i-begin)/4)*4==0) {
|
||||
print(
|
||||
"\e[1000D ",bar.bar((i-begin+1)/total),
|
||||
" (",i-begin+1,"/",total,")\t",
|
||||
res," byte: ",int(byte/1024),"k"
|
||||
);
|
||||
}
|
||||
}
|
||||
print(
|
||||
"\e[1000D ",bar.bar((i-begin)/total),
|
||||
" (",i-begin,"/",total,")\t",
|
||||
res," byte: ",int(byte/1024),"k",
|
||||
" time: ",timestamp.elapsedMSec()
|
||||
);
|
||||
print("\n");
|
||||
};
|
||||
}();
|
||||
|
||||
var filechecksum=func(){
|
||||
var files=[
|
||||
"./stl/fg_env.nas", "./stl/file.nas",
|
||||
"./stl/json.nas", "./stl/lib.nas",
|
||||
"./stl/list.nas", "./stl/log.nas",
|
||||
"./stl/mat.nas", "./stl/module.nas",
|
||||
"./stl/padding.nas", "./stl/process_bar.nas",
|
||||
"./stl/queue.nas", "./stl/result.nas",
|
||||
"./stl/sort.nas", "./stl/stack.nas",
|
||||
"./stl/string.nas",
|
||||
"./test/ascii-art.nas", "./test/auto_crash.nas",
|
||||
"./test/bf.nas", "./test/bfconvertor.nas",
|
||||
"./test/bfs.nas", "./test/bigloop.nas",
|
||||
"./test/bp.nas", "./test/calc.nas",
|
||||
"./test/choice.nas", "./test/class.nas",
|
||||
"./test/console3D.nas",
|
||||
"./test/coroutine.nas", "./test/datalog.nas",
|
||||
"./test/diff.nas", "./test/donuts.nas",
|
||||
"./test/exception.nas", "./test/fib.nas",
|
||||
"./test/filesystem.nas", "./test/hexdump.nas",
|
||||
"./test/httptest.nas", "./test/json.nas",
|
||||
"./test/leetcode1319.nas", "./test/lexer.nas",
|
||||
"./test/life.nas", "./test/loop.nas",
|
||||
"./test/mandel.nas", "./test/mandelbrot.nas",
|
||||
"./test/mcpu.nas",
|
||||
"./test/md5.nas", "./test/md5compare.nas",
|
||||
"./test/module_test.nas", "./test/nasal_test.nas",
|
||||
"./test/occupation.nas", "./test/pi.nas",
|
||||
"./test/ppmgen.nas", "./test/prime.nas",
|
||||
"./test/qrcode.nas", "./test/quick_sort.nas",
|
||||
"./test/scalar.nas", "./test/snake.nas",
|
||||
"./test/tetris.nas", "./test/trait.nas",
|
||||
"./test/turingmachine.nas", "./test/utf8chk.nas",
|
||||
"./test/watchdog.nas", "./test/wavecollapse.nas",
|
||||
"./test/word_collector.nas",
|
||||
"./test/ycombinator.nas", "LICENSE",
|
||||
"main.cpp", "makefile",
|
||||
"nasal_ast.h", "nasal_builtin.h",
|
||||
"nasal_codegen.h", "nasal_dbg.h",
|
||||
"nasal_err.h", "nasal_gc.h",
|
||||
"nasal_import.h", "nasal_lexer.h",
|
||||
"nasal_opt.h", "nasal_parse.h",
|
||||
"nasal_vm.h", "nasal.ebnf",
|
||||
"nasal.h", "README.md"
|
||||
];
|
||||
var files=[];
|
||||
foreach(var p;find_all_files_with_extension("./test","nas")) {
|
||||
append(files,"./test/"~p);
|
||||
}
|
||||
foreach(var p;find_all_files_with_extension("./stl","nas")) {
|
||||
append(files,"./stl/"~p);
|
||||
}
|
||||
foreach(var p;find_all_files_with_extension("./module","nas","cpp")) {
|
||||
append(files,"./module/"~p);
|
||||
}
|
||||
foreach(var p;find_all_files_with_extension(".","cpp","h","md")) {
|
||||
append(files,"./"~p);
|
||||
}
|
||||
foreach(var p;find_all_files_with_extension("./doc","md")) {
|
||||
append(files,"./doc/"~p);
|
||||
}
|
||||
|
||||
var byte=0;
|
||||
var total=size(files);
|
||||
var timestamp=maketimestamp();
|
||||
@@ -87,14 +73,19 @@ var filechecksum=func(){
|
||||
if(cmp(res,_md5(f))){
|
||||
die("error: "~files[i]);
|
||||
}
|
||||
print(" ",bar.bar((i+1)/total)," (",i+1,"/",total,")\t",res," byte: ",int(byte/1024),"k time: ",timestamp.elapsedMSec()," \r");
|
||||
print(
|
||||
"\e[1000D ",bar.bar((i+1)/total),
|
||||
" (",i+1,"/",total,")\t",res,
|
||||
" byte: ",int(byte/1024),"k",
|
||||
" time: ",timestamp.elapsedMSec()
|
||||
);
|
||||
}
|
||||
print("\n");
|
||||
}
|
||||
|
||||
var randomchecksum=func(){
|
||||
for(var i=0;i<4096;i+=512)
|
||||
compare(i,i+512);
|
||||
for(var i=0;i<2048;i+=256)
|
||||
compare(i,i+256);
|
||||
}
|
||||
|
||||
if(os.platform()=="windows")
|
||||
|
||||
Reference in New Issue
Block a user