diff options
Diffstat (limited to 'tests/fuzzing/bc_inputs1')
| -rw-r--r-- | tests/fuzzing/bc_inputs1/array.bc | 60 | ||||
| -rw-r--r-- | tests/fuzzing/bc_inputs1/decimal.txt | 30 | ||||
| -rw-r--r-- | tests/fuzzing/bc_inputs1/functions.bc | 7 | ||||
| -rw-r--r-- | tests/fuzzing/bc_inputs1/len.bc | 48 | ||||
| -rw-r--r-- | tests/fuzzing/bc_inputs1/lib10.txt | 4 | ||||
| -rw-r--r-- | tests/fuzzing/bc_inputs1/lib12.txt | 1 | ||||
| -rw-r--r-- | tests/fuzzing/bc_inputs1/lib2.txt | 15 | ||||
| -rw-r--r-- | tests/fuzzing/bc_inputs1/lib3.txt | 6 | ||||
| -rw-r--r-- | tests/fuzzing/bc_inputs1/lib6.txt | 5 |
9 files changed, 176 insertions, 0 deletions
diff --git a/tests/fuzzing/bc_inputs1/array.bc b/tests/fuzzing/bc_inputs1/array.bc new file mode 100644 index 000000000000..dac232804914 --- /dev/null +++ b/tests/fuzzing/bc_inputs1/array.bc @@ -0,0 +1,60 @@ +#! /usr/bin/bc -q + +define z(a[]) { + for (i = 0; i < l; ++i) { + a[i] + } +} + +define x(a[]) { + + # Test for separate vars and arrays. + auto a + + for (a = 0; a < l; ++a) { + a[a] = -a + } + + z(a[]) +} + +define g(x[], y[]) { + return x[0] - y[0] +} + +define h(y[], x[]) { + return g(x[], y[]) +} + +define m(*x[], *y[]) { + return x[0] / y[0] +} + +define n(*y[], *x[]) { + return m(x[], y[]) +} + +for (i = 0; i < 101; ++i) { + a[i] = i +} + +a[104] = 204 + +l = length(a[]) + +for (i = 0; i <= l; ++i) { + a[i] +} + +z(a[]) +x(a[]) +z(a[]) +l + +x[0] = 5 +y[0] = 4 + +h(x[], y[]) +n(x[], y[]) + +halt diff --git a/tests/fuzzing/bc_inputs1/decimal.txt b/tests/fuzzing/bc_inputs1/decimal.txt new file mode 100644 index 000000000000..b79da99e3dd2 --- /dev/null +++ b/tests/fuzzing/bc_inputs1/decimal.txt @@ -0,0 +1,30 @@ +0 +0.0 +000000000000000000000000.00000000000000000000000 +000000000000000000000000000135482346782356 +000000000000000000000000002 +1 +1023468723275435238491972521917846 +4343472432431705867392073517038270398027352709027389273920739037937960379637893607893607893670530278200795207952702873892786172916728961783907893607418973587857386079679267926737520730925372983782793652793 +-1 +-18586 +-31378682943772818461924738352952347258 +-823945628745673589495067238723986520375698237620834674509627345273096287563846592384526349872634895763257893467523987578690283762897568459072348758071071087813501875908127359018715023841710239872301387278 +.123521346523546 +0.1245923756273856 +-.1024678456387 +-0.8735863475634587 +4.0 +-6.0 +234237468293576.000000000000000000000000000000 +23987623568943567.00000000000000000005677834650000000000000 +23856934568940675.000000000000000435676782300000000000000456784 +77567648698496.000000000000000000587674750000000000458563800000000000000 +2348672354968723.2374823546000000000003256987394502346892435623870000000034578 +-2354768.000000000000000000000000000000000000 +-96739874567.000000000347683456 +-3764568345.000000000004573845000000347683460 +-356784356.934568495770004586495678300000000 +74325437345273852773827101738273127312738521733017537073520735207307570358738257390761276072160719802671980267018728630178.7082681027680521760217867841276127681270867827821768173178207830710978017738178678012767377058785378278207385237085237803278203782037237582795870 +-756752732785273851273728537852738257837283678965738527385272983678372867327835672967385278372637862738627836279863782673862783670.71738178361738718367186378610738617836781603760178367018603760178107735278372832783728367826738627836278378260736270367362073867097307925 +9812734012837410982345719208345712908357412903587192048571920458712.23957182459817249058172945781 diff --git a/tests/fuzzing/bc_inputs1/functions.bc b/tests/fuzzing/bc_inputs1/functions.bc new file mode 100644 index 000000000000..80d6d1623d8d --- /dev/null +++ b/tests/fuzzing/bc_inputs1/functions.bc @@ -0,0 +1,7 @@ +e(0.5) + +define e(x) { + return x +} + +e(0.5) diff --git a/tests/fuzzing/bc_inputs1/len.bc b/tests/fuzzing/bc_inputs1/len.bc new file mode 100644 index 000000000000..ec931f2386a5 --- /dev/null +++ b/tests/fuzzing/bc_inputs1/len.bc @@ -0,0 +1,48 @@ +define fast_gcd(a, b) { + + if (a == b) return a; + if (a > b) return fast_gcd(a - b, b) + + return fast_gcd(a, b - a); +} + +define void r_reduce(*r[]) { + + auto g,s; + + if (length(r[]) != 2) sqrt(-1); + if (scale(r[0])) 2^r[0]; + if (scale(r[1])) 2^r[1]; + + if (r[0] >= 0 && r[1] >= 0) g = fast_gcd(r[0], r[1]); + else g = gcd(r[0], r[1]); + + s = scale; + scale = 0; + + r[0] /= g; + r[1] /= g; + + scale = s; +} + +define void r_init(*r[], a, b) { + r[0] = a; + r[1] = b; + r_reduce(r[]); +} + +define void r_initi(*r[], i, a, b) { + + length(r[]); + + r[0] = i * b + a; + r[1] = b; + + length(r[]); + + r_reduce(r[]); +} + +length(a[]) +r_initi(a[], 5, 63, 94); diff --git a/tests/fuzzing/bc_inputs1/lib10.txt b/tests/fuzzing/bc_inputs1/lib10.txt new file mode 100644 index 000000000000..7aa3fda19cc7 --- /dev/null +++ b/tests/fuzzing/bc_inputs1/lib10.txt @@ -0,0 +1,4 @@ +l10(0) +l10(99) +l10(100) +l10(-100) diff --git a/tests/fuzzing/bc_inputs1/lib12.txt b/tests/fuzzing/bc_inputs1/lib12.txt new file mode 100644 index 000000000000..7d70e1ccdd5e --- /dev/null +++ b/tests/fuzzing/bc_inputs1/lib12.txt @@ -0,0 +1 @@ +uint(0) diff --git a/tests/fuzzing/bc_inputs1/lib2.txt b/tests/fuzzing/bc_inputs1/lib2.txt new file mode 100644 index 000000000000..f345bd1669cb --- /dev/null +++ b/tests/fuzzing/bc_inputs1/lib2.txt @@ -0,0 +1,15 @@ +r(0, 0) +r(0, 1) +r(0, 100) +r(1, 0) +r(1, 3) +r(1.4, 0) +r(1.5, 0) +r(34.45, 2) +r(64.1223, 4) +r(-1, 0) +r(-1, 3) +r(-1.4, 0) +r(-1.5, 0) +r(-34.45, 2) +r(-64.1223, 4) diff --git a/tests/fuzzing/bc_inputs1/lib3.txt b/tests/fuzzing/bc_inputs1/lib3.txt new file mode 100644 index 000000000000..1da42385ea44 --- /dev/null +++ b/tests/fuzzing/bc_inputs1/lib3.txt @@ -0,0 +1,6 @@ +f(0) +f(1) +f(2) +f(3) +f(4) +f(5) diff --git a/tests/fuzzing/bc_inputs1/lib6.txt b/tests/fuzzing/bc_inputs1/lib6.txt new file mode 100644 index 000000000000..260e159f9fb6 --- /dev/null +++ b/tests/fuzzing/bc_inputs1/lib6.txt @@ -0,0 +1,5 @@ +pi(5) +p=pi(scale) +r2d(-p) +d2r(180) +d2r(-180) |
