early-access version 1255

This commit is contained in:
pineappleEA
2020-12-28 15:15:37 +00:00
parent 84b39492d1
commit 78b48028e1
6254 changed files with 1868140 additions and 0 deletions

1
externals/inih/inih/tests/bad_comment.ini vendored Executable file
View File

@@ -0,0 +1 @@
This is an error

1
externals/inih/inih/tests/bad_multi.ini vendored Executable file
View File

@@ -0,0 +1 @@
indented

5
externals/inih/inih/tests/bad_section.ini vendored Executable file
View File

@@ -0,0 +1,5 @@
[section1]
name1=value1
[section2
[section3 ; comment ]
name2=value2

View File

@@ -0,0 +1,7 @@
ini_malloc(12)
... [section]
... foo=bar;
ini_realloc(24)
... bazz=buzz quxx;
ini_free()
basic: e=0

View File

@@ -0,0 +1,69 @@
no_file.ini: e=-1 user=0
... [section1]
... one=This is a test;
... two=1234;
... [ section 2 ]
... happy=4;
... sad=;
... [comment_test]
... test1=1;2;3;
... test2=2;3;4;this won't be a comment, needs whitespace before ';';
... test;3=345;
... test4=4#5#6;
... test7=;
... test8=; not a comment, needs whitespace before ';';
... [colon_tests]
... Content-Type=text/html;
... foo=bar;
... adams=42;
... funny1=with = equals;
... funny2=with : colons;
... funny3=two = equals;
... funny4=two : colons;
normal.ini: e=0 user=101
... [section1]
... name1=value1;
... name2=value2;
bad_section.ini: e=3 user=102
... This is an error;
bad_comment.ini: e=0 user=103
... [section]
... a=b;
... user=parse_error;
... c=d;
user_error.ini: e=3 user=104
... [section1]
... single1=abc;
... multi=this is a;
... multi=multi-line value;
... single2=xyz;
... [section2]
... multi=a;
... multi=b;
... multi=c;
... [section3]
... single=ghi;
... multi=the quick;
... multi=brown fox;
... name=bob smith;
multi_line.ini: e=0 user=105
... indented;
bad_multi.ini: e=0 user=106
... [bom_section]
... bom_name=bom_value;
... key“=value“;
bom.ini: e=0 user=107
... [section1]
... single1=abc;
... single2=xyz;
... single1=def;
... single2=qrs;
duplicate_sections.ini: e=0 user=108
... [section_list]
... section0;
... section1;
... [section0]
... key0=val0;
... [section1]
... key1=val1;
no_value.ini: e=0 user=109

View File

@@ -0,0 +1,67 @@
no_file.ini: e=-1 user=0
... [section1]
... one=This is a test;
... two=1234;
... [ section 2 ]
... happy=4;
... sad=;
... [empty]
... [comment_test]
... test1=1;2;3;
... test2=2;3;4;this won't be a comment, needs whitespace before ';';
... test;3=345;
... test4=4#5#6;
... test7=;
... test8=; not a comment, needs whitespace before ';';
... [colon_tests]
... Content-Type=text/html;
... foo=bar;
... adams=42;
... funny1=with = equals;
... funny2=with : colons;
... funny3=two = equals;
... funny4=two : colons;
normal.ini: e=0 user=101
... [section1]
... name1=value1;
... name2=value2;
bad_section.ini: e=3 user=102
bad_comment.ini: e=1 user=102
... [section]
... a=b;
... user=parse_error;
... c=d;
user_error.ini: e=3 user=104
... [section1]
... single1=abc;
... multi=this is a;
... multi=multi-line value;
... single2=xyz;
... [section2]
... multi=a;
... multi=b;
... multi=c;
... [section3]
... single=ghi;
... multi=the quick;
... multi=brown fox;
... name=bob smith;
multi_line.ini: e=0 user=105
bad_multi.ini: e=1 user=105
... [bom_section]
... bom_name=bom_value;
... key“=value“;
bom.ini: e=0 user=107
... [section1]
... single1=abc;
... single2=xyz;
... [section1]
... single1=def;
... single2=qrs;
duplicate_sections.ini: e=0 user=108
... [section_list]
... [section0]
... key0=val0;
... [section1]
... key1=val1;
no_value.ini: e=2 user=109

View File

@@ -0,0 +1,65 @@
no_file.ini: e=-1 user=0
... [section1]
... one=This is a test ; name=value comment;
... two=1234;
... [ section 2 ]
... happy=4;
... sad=;
... [comment_test]
... test1=1;2;3 ; only this will be a comment;
... test2=2;3;4;this won't be a comment, needs whitespace before ';';
... test;3=345 ; key should be "test;3";
... test4=4#5#6 ; '#' only starts a comment at start of line;
... test7=; blank value, except if inline comments disabled;
... test8=; not a comment, needs whitespace before ';';
... [colon_tests]
... Content-Type=text/html;
... foo=bar;
... adams=42;
... funny1=with = equals;
... funny2=with : colons;
... funny3=two = equals;
... funny4=two : colons;
normal.ini: e=0 user=101
... [section1]
... name1=value1;
... [section3 ; comment ]
... name2=value2;
bad_section.ini: e=3 user=102
bad_comment.ini: e=1 user=102
... [section]
... a=b;
... user=parse_error;
... c=d;
user_error.ini: e=3 user=104
... [section1]
... single1=abc;
... multi=this is a;
... multi=multi-line value;
... single2=xyz;
... [section2]
... multi=a;
... multi=b;
... multi=c;
... [section3]
... single=ghi;
... multi=the quick;
... multi=brown fox;
... name=bob smith ; comment line 1;
multi_line.ini: e=0 user=105
bad_multi.ini: e=1 user=105
... [bom_section]
... bom_name=bom_value;
... key“=value“;
bom.ini: e=0 user=107
... [section1]
... single1=abc;
... single2=xyz;
... single1=def;
... single2=qrs;
duplicate_sections.ini: e=0 user=108
... [section0]
... key0=val0;
... [section1]
... key1=val1;
no_value.ini: e=2 user=109

View File

@@ -0,0 +1,64 @@
no_file.ini: e=-1 user=0
... [section1]
... one=This is a test; line 3
... two=1234; line 4
... [ section 2 ]
... happy=4; line 8
... sad=; line 9
... [comment_test]
... test1=1;2;3; line 15
... test2=2;3;4;this won't be a comment, needs whitespace before ';'; line 16
... test;3=345; line 17
... test4=4#5#6; line 18
... test7=; line 21
... test8=; not a comment, needs whitespace before ';'; line 22
... [colon_tests]
... Content-Type=text/html; line 25
... foo=bar; line 26
... adams=42; line 27
... funny1=with = equals; line 28
... funny2=with : colons; line 29
... funny3=two = equals; line 30
... funny4=two : colons; line 31
normal.ini: e=0 user=101
... [section1]
... name1=value1; line 2
... name2=value2; line 5
bad_section.ini: e=3 user=102
bad_comment.ini: e=1 user=102
... [section]
... a=b; line 2
... user=parse_error; line 3
... c=d; line 4
user_error.ini: e=3 user=104
... [section1]
... single1=abc; line 2
... multi=this is a; line 3
... multi=multi-line value; line 4
... single2=xyz; line 5
... [section2]
... multi=a; line 7
... multi=b; line 8
... multi=c; line 9
... [section3]
... single=ghi; line 11
... multi=the quick; line 12
... multi=brown fox; line 13
... name=bob smith; line 14
multi_line.ini: e=0 user=105
bad_multi.ini: e=1 user=105
... [bom_section]
... bom_name=bom_value; line 2
... key“=value“; line 3
bom.ini: e=0 user=107
... [section1]
... single1=abc; line 2
... single2=xyz; line 3
... single1=def; line 5
... single2=qrs; line 6
duplicate_sections.ini: e=0 user=108
... [section0]
... key0=val0; line 6
... [section1]
... key1=val1; line 9
no_value.ini: e=2 user=109

64
externals/inih/inih/tests/baseline_heap.txt vendored Executable file
View File

@@ -0,0 +1,64 @@
no_file.ini: e=-1 user=0
... [section1]
... one=This is a test;
... two=1234;
... [ section 2 ]
... happy=4;
... sad=;
... [comment_test]
... test1=1;2;3;
... test2=2;3;4;this won't be a comment, needs whitespace before ';';
... test;3=345;
... test4=4#5#6;
... test7=;
... test8=; not a comment, needs whitespace before ';';
... [colon_tests]
... Content-Type=text/html;
... foo=bar;
... adams=42;
... funny1=with = equals;
... funny2=with : colons;
... funny3=two = equals;
... funny4=two : colons;
normal.ini: e=0 user=101
... [section1]
... name1=value1;
... name2=value2;
bad_section.ini: e=3 user=102
bad_comment.ini: e=1 user=102
... [section]
... a=b;
... user=parse_error;
... c=d;
user_error.ini: e=3 user=104
... [section1]
... single1=abc;
... multi=this is a;
... multi=multi-line value;
... single2=xyz;
... [section2]
... multi=a;
... multi=b;
... multi=c;
... [section3]
... single=ghi;
... multi=the quick;
... multi=brown fox;
... name=bob smith;
multi_line.ini: e=0 user=105
bad_multi.ini: e=1 user=105
... [bom_section]
... bom_name=bom_value;
... key“=value“;
bom.ini: e=0 user=107
... [section1]
... single1=abc;
... single2=xyz;
... single1=def;
... single2=qrs;
duplicate_sections.ini: e=0 user=108
... [section0]
... key0=val0;
... [section1]
... key1=val1;
no_value.ini: e=2 user=109

View File

@@ -0,0 +1,68 @@
no_file.ini: e=-1 user=0
... [section1]
... one=This is a test;
... two=1234;
... [ section 2 ]
... happy=4;
... sad=;
... [comment_test]
... test1=1;2;3;
... test2=2;3;4;this;
... test2=needs whitespace b;
... test;3=345;
... test4=4#5#6;
... test4=only starts a comm;
... test7=;
... test8=; not a comm;
... [colon_tests]
... Content-Type=text/;
... foo=bar;
... adams=42;
... funny1=with = equ;
... funny2=with : col;
... funny3=two = equa;
... funny4=two : colo;
normal.ini: e=2 user=101
... [section1]
... name1=value1;
... name2=value2;
bad_section.ini: e=3 user=102
bad_comment.ini: e=1 user=102
... [section]
... a=b;
... user=parse_error;
... c=d;
user_error.ini: e=3 user=104
... [section1]
... single1=abc;
... multi=this is a;
... multi=multi-line;
... single2=xyz;
... [section2]
... multi=a;
... multi=b;
... multi=c;
... [section3]
... single=ghi;
... multi=the quick;
... multi=brown fox;
... name=bob smith;
... name=comment line 1;
... name=comment line 2;
multi_line.ini: e=5 user=105
bad_multi.ini: e=1 user=105
... [bom_section]
... bom_name=bom_value;
... key“=value“;
bom.ini: e=0 user=107
... [section1]
... single1=abc;
... single2=xyz;
... single1=def;
... single2=qrs;
duplicate_sections.ini: e=0 user=108
... [section0]
... key0=val0;
... [section1]
... key1=val1;
no_value.ini: e=2 user=109

View File

@@ -0,0 +1,64 @@
no_file.ini: e=-1 user=0
... [section1]
... one=This is a test;
... two=1234;
... [ section 2 ]
... happy=4;
... sad=;
... [comment_test]
... test1=1;2;3;
... test2=2;3;4;this won't be a comment, needs whitespace before ';';
... test;3=345;
... test4=4#5#6;
... test7=;
... test8=; not a comment, needs whitespace before ';';
... [colon_tests]
... Content-Type=text/html;
... foo=bar;
... adams=42;
... funny1=with = equals;
... funny2=with : colons;
... funny3=two = equals;
... funny4=two : colons;
normal.ini: e=0 user=101
... [section1]
... name1=value1;
... name2=value2;
bad_section.ini: e=3 user=102
bad_comment.ini: e=1 user=102
... [section]
... a=b;
... user=parse_error;
... c=d;
user_error.ini: e=3 user=104
... [section1]
... single1=abc;
... multi=this is a;
... multi=multi-line value;
... single2=xyz;
... [section2]
... multi=a;
... multi=b;
... multi=c;
... [section3]
... single=ghi;
... multi=the quick;
... multi=brown fox;
... name=bob smith;
multi_line.ini: e=0 user=105
bad_multi.ini: e=1 user=105
... [bom_section]
... bom_name=bom_value;
... key“=value“;
bom.ini: e=0 user=107
... [section1]
... single1=abc;
... single2=xyz;
... single1=def;
... single2=qrs;
duplicate_sections.ini: e=0 user=108
... [section0]
... key0=val0;
... [section1]
... key1=val1;
no_value.ini: e=2 user=109

View File

@@ -0,0 +1,68 @@
no_file.ini: e=-1 user=0
... [section1]
... one=This is a test;
... two=1234;
... [ section 2 ]
... happy=4;
... sad=;
... [comment_test]
... test1=1;2;3;
... test2=2;3;4;this;
... test2=needs whitespace b;
... test;3=345;
... test4=4#5#6;
... test4=only starts a comm;
... test7=;
... test8=; not a comm;
... [colon_tests]
... Content-Type=text/;
... foo=bar;
... adams=42;
... funny1=with = equ;
... funny2=with : col;
... funny3=two = equa;
... funny4=two : colo;
normal.ini: e=2 user=101
... [section1]
... name1=value1;
... name2=value2;
bad_section.ini: e=3 user=102
bad_comment.ini: e=1 user=102
... [section]
... a=b;
... user=parse_error;
... c=d;
user_error.ini: e=3 user=104
... [section1]
... single1=abc;
... multi=this is a;
... multi=multi-line;
... single2=xyz;
... [section2]
... multi=a;
... multi=b;
... multi=c;
... [section3]
... single=ghi;
... multi=the quick;
... multi=brown fox;
... name=bob smith;
... name=comment line 1;
... name=comment line 2;
multi_line.ini: e=5 user=105
bad_multi.ini: e=1 user=105
... [bom_section]
... bom_name=bom_value;
... key“=value“;
bom.ini: e=0 user=107
... [section1]
... single1=abc;
... single2=xyz;
... single1=def;
... single2=qrs;
duplicate_sections.ini: e=0 user=108
... [section0]
... key0=val0;
... [section1]
... key1=val1;
no_value.ini: e=2 user=109

View File

@@ -0,0 +1,21 @@
empty string: e=0 user=0
... [section]
... foo=bar;
... bazz=buzz quxx;
basic: e=0 user=101
... [section]
... hello=world;
... forty_two=42;
crlf: e=0 user=102
... [sec]
... foo=0123456789012;
... bar=4321;
long line: e=3 user=103
... [sec]
... foo=0123456789012;
... bix=1234;
long continued: e=0 user=104
... [s]
... a=1;
... c=3;
error: e=3 user=105

64
externals/inih/inih/tests/baseline_multi.txt vendored Executable file
View File

@@ -0,0 +1,64 @@
no_file.ini: e=-1 user=0
... [section1]
... one=This is a test;
... two=1234;
... [ section 2 ]
... happy=4;
... sad=;
... [comment_test]
... test1=1;2;3;
... test2=2;3;4;this won't be a comment, needs whitespace before ';';
... test;3=345;
... test4=4#5#6;
... test7=;
... test8=; not a comment, needs whitespace before ';';
... [colon_tests]
... Content-Type=text/html;
... foo=bar;
... adams=42;
... funny1=with = equals;
... funny2=with : colons;
... funny3=two = equals;
... funny4=two : colons;
normal.ini: e=0 user=101
... [section1]
... name1=value1;
... name2=value2;
bad_section.ini: e=3 user=102
bad_comment.ini: e=1 user=102
... [section]
... a=b;
... user=parse_error;
... c=d;
user_error.ini: e=3 user=104
... [section1]
... single1=abc;
... multi=this is a;
... multi=multi-line value;
... single2=xyz;
... [section2]
... multi=a;
... multi=b;
... multi=c;
... [section3]
... single=ghi;
... multi=the quick;
... multi=brown fox;
... name=bob smith;
multi_line.ini: e=0 user=105
bad_multi.ini: e=1 user=105
... [bom_section]
... bom_name=bom_value;
... key“=value“;
bom.ini: e=0 user=107
... [section1]
... single1=abc;
... single2=xyz;
... single1=def;
... single2=qrs;
duplicate_sections.ini: e=0 user=108
... [section0]
... key0=val0;
... [section1]
... key1=val1;
no_value.ini: e=2 user=109

View File

@@ -0,0 +1,68 @@
no_file.ini: e=-1 user=0
... [section1]
... one=This is a test;
... two=1234;
... [ section 2 ]
... happy=4;
... sad=;
... [comment_test]
... test1=1;2;3;
... test2=2;3;4;this;
... test2=needs whitespace b;
... test;3=345;
... test4=4#5#6;
... test4=only starts a comm;
... test7=;
... test8=; not a comm;
... [colon_tests]
... Content-Type=text/;
... foo=bar;
... adams=42;
... funny1=with = equ;
... funny2=with : col;
... funny3=two = equa;
... funny4=two : colo;
normal.ini: e=2 user=101
... [section1]
... name1=value1;
... name2=value2;
bad_section.ini: e=3 user=102
bad_comment.ini: e=1 user=102
... [section]
... a=b;
... user=parse_error;
... c=d;
user_error.ini: e=3 user=104
... [section1]
... single1=abc;
... multi=this is a;
... multi=multi-line;
... single2=xyz;
... [section2]
... multi=a;
... multi=b;
... multi=c;
... [section3]
... single=ghi;
... multi=the quick;
... multi=brown fox;
... name=bob smith;
... name=comment line 1;
... name=comment line 2;
multi_line.ini: e=5 user=105
bad_multi.ini: e=1 user=105
... [bom_section]
... bom_name=bom_value;
... key“=value“;
bom.ini: e=0 user=107
... [section1]
... single1=abc;
... single2=xyz;
... single1=def;
... single2=qrs;
duplicate_sections.ini: e=0 user=108
... [section0]
... key0=val0;
... [section1]
... key1=val1;
no_value.ini: e=2 user=109

60
externals/inih/inih/tests/baseline_single.txt vendored Executable file
View File

@@ -0,0 +1,60 @@
no_file.ini: e=-1 user=0
... [section1]
... one=This is a test;
... two=1234;
... [ section 2 ]
... happy=4;
... sad=;
... [comment_test]
... test1=1;2;3;
... test2=2;3;4;this won't be a comment, needs whitespace before ';';
... test;3=345;
... test4=4#5#6;
... test7=;
... test8=; not a comment, needs whitespace before ';';
... [colon_tests]
... Content-Type=text/html;
... foo=bar;
... adams=42;
... funny1=with = equals;
... funny2=with : colons;
... funny3=two = equals;
... funny4=two : colons;
normal.ini: e=0 user=101
... [section1]
... name1=value1;
... name2=value2;
bad_section.ini: e=3 user=102
bad_comment.ini: e=1 user=102
... [section]
... a=b;
... user=parse_error;
... c=d;
user_error.ini: e=3 user=104
... [section1]
... single1=abc;
... multi=this is a;
... single2=xyz;
... [section2]
... multi=a;
... [section3]
... single=ghi;
... multi=the quick;
... name=bob smith;
multi_line.ini: e=4 user=105
bad_multi.ini: e=1 user=105
... [bom_section]
... bom_name=bom_value;
... key“=value“;
bom.ini: e=0 user=107
... [section1]
... single1=abc;
... single2=xyz;
... single1=def;
... single2=qrs;
duplicate_sections.ini: e=0 user=108
... [section0]
... key0=val0;
... [section1]
... key1=val1;
no_value.ini: e=2 user=109

View File

@@ -0,0 +1,58 @@
no_file.ini: e=-1 user=0
... [section1]
... one=This is a test;
... two=1234;
... [ section 2 ]
... happy=4;
... sad=;
... [comment_test]
... test1=1;2;3;
... test2=2;3;4;this won't be a comment, needs whitespace before ';';
... test;3=345;
... test4=4#5#6;
... test7=;
... test8=; not a comment, needs whitespace before ';';
... [colon_tests]
... Content-Type=text/html;
... foo=bar;
... adams=42;
... funny1=with = equals;
... funny2=with : colons;
... funny3=two = equals;
... funny4=two : colons;
normal.ini: e=0 user=101
... [section1]
... name1=value1;
bad_section.ini: e=3 user=102
bad_comment.ini: e=1 user=102
... [section]
... a=b;
... user=parse_error;
user_error.ini: e=3 user=104
... [section1]
... single1=abc;
... multi=this is a;
... multi=multi-line value;
... single2=xyz;
... [section2]
... multi=a;
... multi=b;
... multi=c;
... [section3]
... single=ghi;
... multi=the quick;
... multi=brown fox;
... name=bob smith;
multi_line.ini: e=0 user=105
bad_multi.ini: e=1 user=105
... [bom_section]
... bom_name=bom_value;
... key“=value“;
bom.ini: e=0 user=107
... [section1]
... single1=abc;
... single2=xyz;
... single1=def;
... single2=qrs;
duplicate_sections.ini: e=0 user=108
no_value.ini: e=2 user=108

21
externals/inih/inih/tests/baseline_string.txt vendored Executable file
View File

@@ -0,0 +1,21 @@
empty string: e=0 user=0
... [section]
... foo=bar;
... bazz=buzz quxx;
basic: e=0 user=101
... [section]
... hello=world;
... forty_two=42;
crlf: e=0 user=102
... [sec]
... foo=0123456789012;
... bar=4321;
long line: e=3 user=103
... [sec]
... foo=0123456789012;
... bix=1234;
long continued: e=0 user=104
... [s]
... a=1;
... c=3;
error: e=3 user=105

3
externals/inih/inih/tests/bom.ini vendored Executable file
View File

@@ -0,0 +1,3 @@
[bom_section]
bom_name=bom_value
key“ = value“

View File

@@ -0,0 +1,6 @@
[section1]
single1 = abc
single2 = xyz
[section1]
single1 = def
single2 = qrs

15
externals/inih/inih/tests/multi_line.ini vendored Executable file
View File

@@ -0,0 +1,15 @@
[section1]
single1 = abc
multi = this is a
multi-line value
single2 = xyz
[section2]
multi = a
b
c
[section3]
single: ghi
multi: the quick
brown fox
name = bob smith ; comment line 1
; comment line 2

9
externals/inih/inih/tests/no_value.ini vendored Executable file
View File

@@ -0,0 +1,9 @@
[section_list]
section0
section1
[section0]
key0=val0
[section1]
key1=val1

31
externals/inih/inih/tests/normal.ini vendored Executable file
View File

@@ -0,0 +1,31 @@
; This is an INI file
[section1] ; section comment
one=This is a test ; name=value comment
two = 1234
; x=y
[ section 2 ]
happy = 4
sad =
[empty]
; do nothing
[comment_test]
test1 = 1;2;3 ; only this will be a comment
test2 = 2;3;4;this won't be a comment, needs whitespace before ';'
test;3 = 345 ; key should be "test;3"
test4 = 4#5#6 ; '#' only starts a comment at start of line
#test5 = 567 ; entire line commented
# test6 = 678 ; entire line commented, except in MULTILINE mode
test7 = ; blank value, except if inline comments disabled
test8 =; not a comment, needs whitespace before ';'
[colon_tests]
Content-Type: text/html
foo:bar
adams : 42
funny1 : with = equals
funny2 = with : colons
funny3 = two = equals
funny4 : two : colons

14
externals/inih/inih/tests/unittest.bat vendored Executable file
View File

@@ -0,0 +1,14 @@
@call tcc ..\ini.c -I..\ -run unittest.c > baseline_multi.txt
@call tcc ..\ini.c -I..\ -DINI_MAX_LINE=20 -run unittest.c > baseline_multi_max_line.txt
@call tcc ..\ini.c -I..\ -DINI_ALLOW_MULTILINE=0 -run unittest.c > baseline_single.txt
@call tcc ..\ini.c -I..\ -DINI_ALLOW_INLINE_COMMENTS=0 -run unittest.c > baseline_disallow_inline_comments.txt
@call tcc ..\ini.c -I..\ -DINI_STOP_ON_FIRST_ERROR=1 -run unittest.c > baseline_stop_on_first_error.txt
@call tcc ..\ini.c -I..\ -DINI_HANDLER_LINENO=1 -run unittest.c > baseline_handler_lineno.txt
@call tcc ..\ini.c -I..\ -DINI_USE_STACK=0 -run unittest.c > baseline_heap.txt
@call tcc ..\ini.c -I..\ -DINI_USE_STACK=0 -DINI_MAX_LINE=20 -DINI_INITIAL_ALLOC=20 -run unittest.c > baseline_heap_max_line.txt
@call tcc ..\ini.c -I..\ -DINI_USE_STACK=0 -DINI_ALLOW_REALLOC=1 -DINI_INITIAL_ALLOC=5 -run unittest.c > baseline_heap_realloc.txt
@call tcc ..\ini.c -I..\ -DINI_USE_STACK=0 -DINI_MAX_LINE=20 -DINI_ALLOW_REALLOC=1 -DINI_INITIAL_ALLOC=5 -run unittest.c > baseline_heap_realloc_max_line.txt
@call tcc ..\ini.c -I..\ -DINI_USE_STACK=0 -DINI_MAX_LINE=20 -DINI_INITIAL_ALLOC=20 -run unittest.c > baseline_heap_string.txt
@call tcc ..\ini.c -I..\ -DINI_CALL_HANDLER_ON_NEW_SECTION=1 -run unittest.c > baseline_call_handler_on_new_section.txt
@call tcc ..\ini.c -I..\ -DINI_ALLOW_NO_VALUE=1 -run unittest.c > baseline_allow_no_value.txt
@call tcc ..\ini.c -I..\ -DINI_CUSTOM_ALLOCATOR=1 -DINI_USE_STACK=0 -DINI_ALLOW_REALLOC=1 -DINI_INITIAL_ALLOC=12 -run unittest_alloc.c > baseline_alloc.txt

71
externals/inih/inih/tests/unittest.c vendored Executable file
View File

@@ -0,0 +1,71 @@
/* inih -- unit tests
This works simply by dumping a bunch of info to standard output, which is
redirected to an output file (baseline_*.txt) and checked into the Subversion
repository. This baseline file is the test output, so the idea is to check it
once, and if it changes -- look at the diff and see which tests failed.
See unittest.bat and unittest.sh for how to run this (with tcc and gcc,
respectively).
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../ini.h"
int User;
char Prev_section[50];
#if INI_HANDLER_LINENO
int dumper(void* user, const char* section, const char* name,
const char* value, int lineno)
#else
int dumper(void* user, const char* section, const char* name,
const char* value)
#endif
{
User = *((int*)user);
if (!name || strcmp(section, Prev_section)) {
printf("... [%s]\n", section);
strncpy(Prev_section, section, sizeof(Prev_section));
Prev_section[sizeof(Prev_section) - 1] = '\0';
}
if (!name) {
return 1;
}
#if INI_HANDLER_LINENO
printf("... %s%s%s; line %d\n", name, value ? "=" : "", value ? value : "", lineno);
#else
printf("... %s%s%s;\n", name, value ? "=" : "", value ? value : "");
#endif
return strcmp(name, "user")==0 && strcmp(value, "parse_error")==0 ? 0 : 1;
}
void parse(const char* fname) {
static int u = 100;
int e;
*Prev_section = '\0';
e = ini_parse(fname, dumper, &u);
printf("%s: e=%d user=%d\n", fname, e, User);
u++;
}
int main(void)
{
parse("no_file.ini");
parse("normal.ini");
parse("bad_section.ini");
parse("bad_comment.ini");
parse("user_error.ini");
parse("multi_line.ini");
parse("bad_multi.ini");
parse("bom.ini");
parse("duplicate_sections.ini");
parse("no_value.ini");
return 0;
}

61
externals/inih/inih/tests/unittest.sh vendored Executable file
View File

@@ -0,0 +1,61 @@
#!/usr/bin/env bash
gcc ../ini.c unittest.c -o unittest_multi
./unittest_multi > baseline_multi.txt
rm -f unittest_multi
gcc ../ini.c -DINI_MAX_LINE=20 unittest.c -o unittest_multi_max_line
./unittest_multi_max_line > baseline_multi_max_line.txt
rm -f unittest_multi_max_line
gcc ../ini.c -DINI_ALLOW_MULTILINE=0 unittest.c -o unittest_single
./unittest_single > baseline_single.txt
rm -f unittest_single
gcc ../ini.c -DINI_ALLOW_INLINE_COMMENTS=0 unittest.c -o unittest_disallow_inline_comments
./unittest_disallow_inline_comments > baseline_disallow_inline_comments.txt
rm -f unittest_disallow_inline_comments
gcc ../ini.c -DINI_STOP_ON_FIRST_ERROR=1 unittest.c -o unittest_stop_on_first_error
./unittest_stop_on_first_error > baseline_stop_on_first_error.txt
rm -f unittest_stop_on_first_error
gcc ../ini.c -DINI_HANDLER_LINENO=1 unittest.c -o unittest_handler_lineno
./unittest_handler_lineno > baseline_handler_lineno.txt
rm -f unittest_handler_lineno
gcc ../ini.c -DINI_MAX_LINE=20 unittest_string.c -o unittest_string
./unittest_string > baseline_string.txt
rm -f unittest_string
gcc ../ini.c -DINI_USE_STACK=0 unittest.c -o unittest_heap
./unittest_heap > baseline_heap.txt
rm -f unittest_heap
gcc ../ini.c -DINI_USE_STACK=0 -DINI_MAX_LINE=20 -DINI_INITIAL_ALLOC=20 unittest.c -o unittest_heap_max_line
./unittest_heap_max_line > baseline_heap_max_line.txt
rm -f unittest_heap_max_line
gcc ../ini.c -DINI_USE_STACK=0 -DINI_ALLOW_REALLOC=1 -DINI_INITIAL_ALLOC=5 unittest.c -o unittest_heap_realloc
./unittest_heap_realloc > baseline_heap_realloc.txt
rm -f unittest_heap_realloc
gcc ../ini.c -DINI_USE_STACK=0 -DINI_MAX_LINE=20 -DINI_ALLOW_REALLOC=1 -DINI_INITIAL_ALLOC=5 unittest.c -o unittest_heap_realloc_max_line
./unittest_heap_realloc_max_line > baseline_heap_realloc_max_line.txt
rm -f unittest_heap_realloc_max_line
gcc ../ini.c -DINI_USE_STACK=0 -DINI_MAX_LINE=20 -DINI_INITIAL_ALLOC=20 unittest_string.c -o unittest_heap_string
./unittest_heap_string > baseline_heap_string.txt
rm -f unittest_heap_string
gcc ../ini.c -DINI_CALL_HANDLER_ON_NEW_SECTION=1 unittest.c -o unittest_call_handler_on_new_section
./unittest_call_handler_on_new_section > baseline_call_handler_on_new_section.txt
rm -f unittest_call_handler_on_new_section
gcc ../ini.c -DINI_ALLOW_NO_VALUE=1 unittest.c -o unittest_allow_no_value
./unittest_allow_no_value > baseline_allow_no_value.txt
rm -f unittest_allow_no_value
gcc -DINI_CUSTOM_ALLOCATOR=1 -DINI_USE_STACK=0 -DINI_ALLOW_REALLOC=1 -DINI_INITIAL_ALLOC=12 ../ini.c unittest_alloc.c -o unittest_alloc
./unittest_alloc > baseline_alloc.txt
rm -f unittest_alloc

49
externals/inih/inih/tests/unittest_alloc.c vendored Executable file
View File

@@ -0,0 +1,49 @@
/* inih -- unit tests for custom memory allocator */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../ini.h"
void* ini_malloc(size_t size) {
printf("ini_malloc(%d)\n", (int)size);
return malloc(size);
}
void ini_free(void* ptr) {
printf("ini_free()\n");
free(ptr);
}
void* ini_realloc(void* ptr, size_t size) {
printf("ini_realloc(%d)\n", (int)size);
return realloc(ptr, size);
}
char Prev_section[50];
int dumper(void* user, const char* section, const char* name,
const char* value)
{
if (strcmp(section, Prev_section)) {
printf("... [%s]\n", section);
strncpy(Prev_section, section, sizeof(Prev_section));
Prev_section[sizeof(Prev_section) - 1] = '\0';
}
printf("... %s=%s;\n", name, value);
return 1;
}
void parse(const char* name, const char* string) {
int e;
*Prev_section = '\0';
e = ini_parse_string(string, dumper, NULL);
printf("%s: e=%d\n", name, e);
}
int main(void)
{
parse("basic", "[section]\nfoo = bar\nbazz = buzz quxx");
return 0;
}

43
externals/inih/inih/tests/unittest_string.c vendored Executable file
View File

@@ -0,0 +1,43 @@
/* inih -- unit tests for ini_parse_string() */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../ini.h"
int User;
char Prev_section[50];
int dumper(void* user, const char* section, const char* name,
const char* value)
{
User = *((int*)user);
if (strcmp(section, Prev_section)) {
printf("... [%s]\n", section);
strncpy(Prev_section, section, sizeof(Prev_section));
Prev_section[sizeof(Prev_section) - 1] = '\0';
}
printf("... %s=%s;\n", name, value);
return 1;
}
void parse(const char* name, const char* string) {
static int u = 100;
int e;
*Prev_section = '\0';
e = ini_parse_string(string, dumper, &u);
printf("%s: e=%d user=%d\n", name, e, User);
u++;
}
int main(void)
{
parse("empty string", "");
parse("basic", "[section]\nfoo = bar\nbazz = buzz quxx");
parse("crlf", "[section]\r\nhello = world\r\nforty_two = 42\r\n");
parse("long line", "[sec]\nfoo = 01234567890123456789\nbar=4321\n");
parse("long continued", "[sec]\nfoo = 0123456789012bix=1234\n");
parse("error", "[s]\na=1\nb\nc=3");
return 0;
}

4
externals/inih/inih/tests/user_error.ini vendored Executable file
View File

@@ -0,0 +1,4 @@
[section]
a = b
user = parse_error
c = d