diff options
author | Eduardo Julian | 2022-10-20 15:11:05 -0400 |
---|---|---|
committer | Eduardo Julian | 2022-10-20 15:11:05 -0400 |
commit | 3525998c8fa9768dfeb333c553ccd71f38ac5311 (patch) | |
tree | 43007cbe3d6710d70cd006762384d937b6e21c36 /stdlib/source/test | |
parent | 820ffc0a87d7960e62508fc451d9df7a94a6afa7 (diff) |
Migrating default extensions to the new format [Part 3]
Diffstat (limited to 'stdlib/source/test')
-rw-r--r-- | stdlib/source/test/lux/ffi.jvm.lux | 4 | ||||
-rw-r--r-- | stdlib/source/test/lux/meta/target/jvm.lux | 361 | ||||
-rw-r--r-- | stdlib/source/test/lux/world/net.lux | 4 | ||||
-rw-r--r-- | stdlib/source/test/lux/world/net/http/version.lux | 48 |
4 files changed, 233 insertions, 184 deletions
diff --git a/stdlib/source/test/lux/ffi.jvm.lux b/stdlib/source/test/lux/ffi.jvm.lux index d7d05321d..c50dfc7e8 100644 --- a/stdlib/source/test/lux/ffi.jvm.lux +++ b/stdlib/source/test/lux/ffi.jvm.lux @@ -210,9 +210,9 @@ [(_.coverage [<object> <primitive>] (|> <jvm#value> (is <object>) - "jvm object cast" + .jvm_object_cast# (is <primitive>) - "jvm object cast" + .jvm_object_cast# (is <object>) (<jvm#=> <jvm#value>))) (_.coverage [<as> <of>] diff --git a/stdlib/source/test/lux/meta/target/jvm.lux b/stdlib/source/test/lux/meta/target/jvm.lux index b7c487680..6330dcbe2 100644 --- a/stdlib/source/test/lux/meta/target/jvm.lux +++ b/stdlib/source/test/lux/meta/target/jvm.lux @@ -133,12 +133,12 @@ (list) (list) (list (/method.method ..method_modifier - method_name - false (/type.method [(list) (list) ..$Object (list)]) - (list) - {.#Some (do /.monad - [_ bytecode] - /.areturn)})) + method_name + false (/type.method [(list) (list) ..$Object (list)]) + (list) + {.#Some (do /.monad + [_ bytecode] + /.areturn)})) (sequence.sequence)) .let [bytecode (binary.result /class.format class) loader (/loader.memory (/loader.new_library []))] @@ -331,7 +331,7 @@ (|>> (as <type>) <to_long> ("jvm leq" expected)) @.jvm - (|>> (as <type>) <to_long> "jvm object cast" ("jvm long =" ("jvm object cast" (as java/lang/Long expected)))))) + (|>> (as <type>) <to_long> .jvm_object_cast# (.jvm_long_=# (.jvm_object_cast# (as java/lang/Long expected)))))) (do /.monad [_ (<push> (|> expected .int <signed> try.trusted))] <wrap>))))] @@ -349,9 +349,9 @@ (<old_extension> subject parameter) @.jvm - ("jvm object cast" - (<new_extension> ("jvm object cast" parameter) - ("jvm object cast" subject))))))]))] + (.jvm_object_cast# + (<new_extension> (.jvm_object_cast# parameter) + (.jvm_object_cast# subject))))))]))] [int/2 java/lang/Integer] [long/2 java/lang/Long] @@ -367,9 +367,9 @@ (<old_extension> subject parameter) @.jvm - ("jvm object cast" - (<new_extension> ("jvm object cast" parameter) - ("jvm object cast" subject))))))])) + (.jvm_object_cast# + (<new_extension> (.jvm_object_cast# parameter) + (.jvm_object_cast# subject))))))])) (def int Test @@ -379,7 +379,7 @@ (|>> (as java/lang/Integer) ("jvm ieq" expected)) @.jvm - (|>> (as java/lang/Integer) "jvm object cast" ("jvm int =" ("jvm object cast" expected))))) + (|>> (as java/lang/Integer) .jvm_object_cast# (.jvm_int_=# (.jvm_object_cast# expected))))) (do /.monad [_ bytecode] ..$Integer::wrap)))) @@ -426,23 +426,23 @@ [expected ..$Integer::random] (int expected (..$Integer::literal expected))))) arithmetic (all _.and - (_.lifted "IADD" (binary (int/2 "jvm iadd" "jvm int +") /.iadd)) - (_.lifted "ISUB" (binary (int/2 "jvm isub" "jvm int -") /.isub)) - (_.lifted "IMUL" (binary (int/2 "jvm imul" "jvm int *") /.imul)) - (_.lifted "IDIV" (binary (int/2 "jvm idiv" "jvm int /") /.idiv)) - (_.lifted "IREM" (binary (int/2 "jvm irem" "jvm int %") /.irem)) + (_.lifted "IADD" (binary (int/2 "jvm iadd" .jvm_int_+#) /.iadd)) + (_.lifted "ISUB" (binary (int/2 "jvm isub" .jvm_int_-#) /.isub)) + (_.lifted "IMUL" (binary (int/2 "jvm imul" .jvm_int_*#) /.imul)) + (_.lifted "IDIV" (binary (int/2 "jvm idiv" .jvm_int_/#) /.idiv)) + (_.lifted "IREM" (binary (int/2 "jvm irem" .jvm_int_%#) /.irem)) (_.lifted "INEG" (unary (function (_ value) - ((int/2 "jvm isub" "jvm int -") + ((int/2 "jvm isub" .jvm_int_-#) value (ffi.long_to_int (as java/lang/Long +0)))) /.ineg))) bitwise (all _.and - (_.lifted "IAND" (binary (int/2 "jvm iand" "jvm int and") /.iand)) - (_.lifted "IOR" (binary (int/2 "jvm ior" "jvm int or") /.ior)) - (_.lifted "IXOR" (binary (int/2 "jvm ixor" "jvm int xor") /.ixor)) - (_.lifted "ISHL" (shift (int/2 "jvm ishl" "jvm int shl") /.ishl)) - (_.lifted "ISHR" (shift (int/2 "jvm ishr" "jvm int shr") /.ishr)) - (_.lifted "IUSHR" (shift (int/2 "jvm iushr" "jvm int ushr") /.iushr)))] + (_.lifted "IAND" (binary (int/2 "jvm iand" .jvm_int_and#) /.iand)) + (_.lifted "IOR" (binary (int/2 "jvm ior" .jvm_int_or#) /.ior)) + (_.lifted "IXOR" (binary (int/2 "jvm ixor" .jvm_int_xor#) /.ixor)) + (_.lifted "ISHL" (shift (int/2 "jvm ishl" .jvm_int_shl#) /.ishl)) + (_.lifted "ISHR" (shift (int/2 "jvm ishr" .jvm_int_shr#) /.ishr)) + (_.lifted "IUSHR" (shift (int/2 "jvm iushr" .jvm_int_ushr#) /.iushr)))] (all _.and (<| (_.context "literal") literal) @@ -460,7 +460,7 @@ (|>> (as Int) (i.= expected)) @.jvm - (|>> (as java/lang/Long) "jvm object cast" ("jvm long =" ("jvm object cast" expected))))) + (|>> (as java/lang/Long) .jvm_object_cast# (.jvm_long_=# (.jvm_object_cast# expected))))) (do /.monad [_ bytecode] ..$Long::wrap)))) @@ -500,23 +500,23 @@ [expected ..$Long::random] (long expected (..$Long::literal expected))))) arithmetic (all _.and - (_.lifted "LADD" (binary (long/2 "jvm ladd" "jvm long +") /.ladd)) - (_.lifted "LSUB" (binary (long/2 "jvm lsub" "jvm long -") /.lsub)) - (_.lifted "LMUL" (binary (long/2 "jvm lmul" "jvm long *") /.lmul)) - (_.lifted "LDIV" (binary (long/2 "jvm ldiv" "jvm long /") /.ldiv)) - (_.lifted "LREM" (binary (long/2 "jvm lrem" "jvm long %") /.lrem)) + (_.lifted "LADD" (binary (long/2 "jvm ladd" .jvm_long_+#) /.ladd)) + (_.lifted "LSUB" (binary (long/2 "jvm lsub" .jvm_long_-#) /.lsub)) + (_.lifted "LMUL" (binary (long/2 "jvm lmul" .jvm_long_*#) /.lmul)) + (_.lifted "LDIV" (binary (long/2 "jvm ldiv" .jvm_long_/#) /.ldiv)) + (_.lifted "LREM" (binary (long/2 "jvm lrem" .jvm_long_%#) /.lrem)) (_.lifted "LNEG" (unary (function (_ value) - ((long/2 "jvm lsub" "jvm long -") + ((long/2 "jvm lsub" .jvm_long_-#) value (as java/lang/Long +0))) /.lneg))) bitwise (all _.and - (_.lifted "LAND" (binary (long/2 "jvm land" "jvm long and") /.land)) - (_.lifted "LOR" (binary (long/2 "jvm lor" "jvm long or") /.lor)) - (_.lifted "LXOR" (binary (long/2 "jvm lxor" "jvm long xor") /.lxor)) - (_.lifted "LSHL" (shift (int+long/2 "jvm lshl" "jvm long shl") /.lshl)) - (_.lifted "LSHR" (shift (int+long/2 "jvm lshr" "jvm long shr") /.lshr)) - (_.lifted "LUSHR" (shift (int+long/2 "jvm lushr" "jvm long ushr") /.lushr))) + (_.lifted "LAND" (binary (long/2 "jvm land" .jvm_long_and#) /.land)) + (_.lifted "LOR" (binary (long/2 "jvm lor" .jvm_long_or#) /.lor)) + (_.lifted "LXOR" (binary (long/2 "jvm lxor" .jvm_long_xor#) /.lxor)) + (_.lifted "LSHL" (shift (int+long/2 "jvm lshl" .jvm_long_shl#) /.lshl)) + (_.lifted "LSHR" (shift (int+long/2 "jvm lshr" .jvm_long_shr#) /.lshr)) + (_.lifted "LUSHR" (shift (int+long/2 "jvm lushr" .jvm_long_ushr#) /.lushr))) comparison (_.lifted "LCMP" (do random.monad [reference ..$Long::random @@ -533,7 +533,7 @@ (|>> (as Int) (i.= expected)) @.jvm - (|>> (as java/lang/Long) "jvm object cast" ("jvm long =" ("jvm object cast" expected))))) + (|>> (as java/lang/Long) .jvm_object_cast# (.jvm_long_=# (.jvm_object_cast# expected))))) (do /.monad [_ (..$Long::literal subject) _ (..$Long::literal reference) @@ -563,7 +563,7 @@ @.jvm (function (_ actual) - (or (|> actual (as java/lang/Float) "jvm object cast" ("jvm float =" ("jvm object cast" expected))) + (or (|> actual (as java/lang/Float) .jvm_object_cast# (.jvm_float_=# (.jvm_object_cast# expected))) (and (f.not_a_number? (as Frac (ffi.float_to_double expected))) (f.not_a_number? (as Frac (ffi.float_to_double (as java/lang/Float actual))))))))) (do /.monad @@ -600,13 +600,13 @@ [expected ..$Float::random] (float expected (..$Float::literal expected))))) arithmetic (all _.and - (_.lifted "FADD" (binary (float/2 "jvm fadd" "jvm float +") /.fadd)) - (_.lifted "FSUB" (binary (float/2 "jvm fsub" "jvm float -") /.fsub)) - (_.lifted "FMUL" (binary (float/2 "jvm fmul" "jvm float *") /.fmul)) - (_.lifted "FDIV" (binary (float/2 "jvm fdiv" "jvm float /") /.fdiv)) - (_.lifted "FREM" (binary (float/2 "jvm frem" "jvm float %") /.frem)) + (_.lifted "FADD" (binary (float/2 "jvm fadd" .jvm_float_+#) /.fadd)) + (_.lifted "FSUB" (binary (float/2 "jvm fsub" .jvm_float_-#) /.fsub)) + (_.lifted "FMUL" (binary (float/2 "jvm fmul" .jvm_float_*#) /.fmul)) + (_.lifted "FDIV" (binary (float/2 "jvm fdiv" .jvm_float_/#) /.fdiv)) + (_.lifted "FREM" (binary (float/2 "jvm frem" .jvm_float_%#) /.frem)) (_.lifted "FNEG" (unary (function (_ value) - ((float/2 "jvm fsub" "jvm float -") + ((float/2 "jvm fsub" .jvm_float_-#) value (ffi.double_to_float (as java/lang/Double +0.0)))) /.fneg))) @@ -621,7 +621,7 @@ ("jvm feq" reference subject) @.jvm - ("jvm float =" ("jvm object cast" reference) ("jvm object cast" subject))) + (.jvm_float_=# (.jvm_object_cast# reference) (.jvm_object_cast# subject))) +0 (if (standard reference subject) +1 @@ -639,7 +639,7 @@ ("jvm fgt" subject reference) @.jvm - ("jvm float <" ("jvm object cast" subject) ("jvm object cast" reference))))) + (.jvm_float_<# (.jvm_object_cast# subject) (.jvm_object_cast# reference))))) comparison (all _.and (_.lifted "FCMPL" (comparison /.fcmpl comparison_standard)) (_.lifted "FCMPG" (comparison /.fcmpg comparison_standard)))] @@ -664,7 +664,7 @@ @.jvm (function (_ actual) - (or (|> actual (as java/lang/Double) "jvm object cast" ("jvm double =" ("jvm object cast" expected))) + (or (|> actual (as java/lang/Double) .jvm_object_cast# (.jvm_double_=# (.jvm_object_cast# expected))) (and (f.not_a_number? (as Frac expected)) (f.not_a_number? (as Frac actual))))))) (do /.monad @@ -696,13 +696,13 @@ [expected ..$Double::random] (double expected (..$Double::literal expected))))) arithmetic (all _.and - (_.lifted "DADD" (binary (double/2 "jvm dadd" "jvm double +") /.dadd)) - (_.lifted "DSUB" (binary (double/2 "jvm dsub" "jvm double -") /.dsub)) - (_.lifted "DMUL" (binary (double/2 "jvm dmul" "jvm double *") /.dmul)) - (_.lifted "DDIV" (binary (double/2 "jvm ddiv" "jvm double /") /.ddiv)) - (_.lifted "DREM" (binary (double/2 "jvm drem" "jvm double %") /.drem)) + (_.lifted "DADD" (binary (double/2 "jvm dadd" .jvm_double_+#) /.dadd)) + (_.lifted "DSUB" (binary (double/2 "jvm dsub" .jvm_double_-#) /.dsub)) + (_.lifted "DMUL" (binary (double/2 "jvm dmul" .jvm_double_*#) /.dmul)) + (_.lifted "DDIV" (binary (double/2 "jvm ddiv" .jvm_double_/#) /.ddiv)) + (_.lifted "DREM" (binary (double/2 "jvm drem" .jvm_double_%#) /.drem)) (_.lifted "DNEG" (unary (function (_ value) - ((double/2 "jvm dsub" "jvm double -") + ((double/2 "jvm dsub" .jvm_double_-#) value (as java/lang/Double +0.0))) /.dneg))) @@ -715,7 +715,7 @@ ("jvm deq" reference subject) @.jvm - ("jvm double =" ("jvm object cast" reference) ("jvm object cast" subject))) + (.jvm_double_=# (.jvm_object_cast# reference) (.jvm_object_cast# subject))) +0 (if (standard reference subject) +1 @@ -734,7 +734,7 @@ ("jvm dgt" subject reference) @.jvm - ("jvm double <" ("jvm object cast" subject) ("jvm object cast" reference))))) + (.jvm_double_<# (.jvm_object_cast# subject) (.jvm_object_cast# reference))))) comparison (all _.and (_.lifted "DCMPL" (comparison /.dcmpl comparison_standard)) (_.lifted "DCMPG" (comparison /.dcmpg comparison_standard)))] @@ -816,7 +816,7 @@ (|>> (as java/lang/Double) ("jvm deq" expected)) @.jvm - (|>> (as java/lang/Double) "jvm object cast" ("jvm double =" ("jvm object cast" expected))))) + (|>> (as java/lang/Double) .jvm_object_cast# (.jvm_double_=# (.jvm_object_cast# expected))))) (do /.monad [_ (/.double expected)] (/.invokestatic ..$Double "valueOf" (/type.method [(list) (list /type.double) ..$Double (list)])))) @@ -837,7 +837,7 @@ (|>> (as java/lang/Double) ("jvm deq" expected)) @.jvm - (|>> (as java/lang/Double) "jvm object cast" ("jvm double =" ("jvm object cast" expected))))) + (|>> (as java/lang/Double) .jvm_object_cast# (.jvm_double_=# (.jvm_object_cast# expected))))) (do /.monad [_ (/.new ..$Double) _ /.dup @@ -865,8 +865,8 @@ ("jvm ladd" part0 part1) @.jvm - ("jvm object cast" - ("jvm long +" ("jvm object cast" part0) ("jvm object cast" part1))))) + (.jvm_object_cast# + (.jvm_long_+# (.jvm_object_cast# part0) (.jvm_object_cast# part1))))) $Self (/type.class class_name (list)) class_field "class_field" object_field "object_field" @@ -881,34 +881,34 @@ (list (/field.field /field.static class_field false /type.long (sequence.sequence)) (/field.field /field.public object_field false /type.long (sequence.sequence))) (list (/method.method /method.private - constructor - false constructor::type - (list) - {.#Some (do /.monad - [_ /.aload_0 - _ (/.invokespecial ..$Object constructor (/type.method [(list) (list) /type.void (list)])) - _ (..$Long::literal part0) - _ (/.putstatic $Self class_field /type.long) - _ /.aload_0 - _ /.lload_1 - _ (/.putfield $Self object_field /type.long)] - /.return)}) + constructor + false constructor::type + (list) + {.#Some (do /.monad + [_ /.aload_0 + _ (/.invokespecial ..$Object constructor (/type.method [(list) (list) /type.void (list)])) + _ (..$Long::literal part0) + _ (/.putstatic $Self class_field /type.long) + _ /.aload_0 + _ /.lload_1 + _ (/.putfield $Self object_field /type.long)] + /.return)}) (/method.method (all /modifier#composite /method.public /method.static) - static_method - false (/type.method [(list) (list) ..$Long (list)]) - (list) - {.#Some (do /.monad - [_ (/.new $Self) - _ /.dup - _ (..$Long::literal part1) - _ (/.invokespecial $Self constructor constructor::type) - _ (/.getfield $Self object_field /type.long) - _ (/.getstatic $Self class_field /type.long) - _ /.ladd - _ ..$Long::wrap] - /.areturn)})) + static_method + false (/type.method [(list) (list) ..$Long (list)]) + (list) + {.#Some (do /.monad + [_ (/.new $Self) + _ /.dup + _ (..$Long::literal part1) + _ (/.invokespecial $Self constructor constructor::type) + _ (/.getfield $Self object_field /type.long) + _ (/.getstatic $Self class_field /type.long) + _ /.ladd + _ ..$Long::wrap] + /.areturn)})) (sequence.sequence)) try.trusted (binary.result /class.format)) @@ -985,7 +985,7 @@ (|>> (as java/lang/Byte) ffi.byte_to_long ("jvm leq" (ffi.byte_to_long expected))) @.jvm - (|>> (as java/lang/Byte) ffi.byte_to_long "jvm object cast" ("jvm long =" ("jvm object cast" (ffi.byte_to_long (as java/lang/Byte expected))))))))) + (|>> (as java/lang/Byte) ffi.byte_to_long .jvm_object_cast# (.jvm_long_=# (.jvm_object_cast# (ffi.byte_to_long (as java/lang/Byte expected))))))))) (_.context "short" (array (/.newarray /instruction.t_short) $Short::random $Short::literal [/.sastore /.saload $Short::wrap] (function (_ expected) @@ -993,7 +993,7 @@ (|>> (as java/lang/Short) ffi.short_to_long ("jvm leq" (ffi.short_to_long expected))) @.jvm - (|>> (as java/lang/Short) ffi.short_to_long "jvm object cast" ("jvm long =" ("jvm object cast" (ffi.short_to_long (as java/lang/Short expected))))))))) + (|>> (as java/lang/Short) ffi.short_to_long .jvm_object_cast# (.jvm_long_=# (.jvm_object_cast# (ffi.short_to_long (as java/lang/Short expected))))))))) (_.context "int" (array (/.newarray /instruction.t_int) $Integer::random $Integer::literal [/.iastore /.iaload $Integer::wrap] (function (_ expected) @@ -1001,7 +1001,7 @@ (|>> (as java/lang/Integer) ("jvm ieq" (as java/lang/Integer expected))) @.jvm - (|>> (as java/lang/Integer) "jvm object cast" ("jvm int =" ("jvm object cast" (as java/lang/Integer expected)))))))) + (|>> (as java/lang/Integer) .jvm_object_cast# (.jvm_int_=# (.jvm_object_cast# (as java/lang/Integer expected)))))))) (_.context "long" (array (/.newarray /instruction.t_long) $Long::random $Long::literal [/.lastore /.laload $Long::wrap] (function (_ expected) @@ -1009,7 +1009,7 @@ (|>> (as java/lang/Long) ("jvm leq" expected)) @.jvm - (|>> (as java/lang/Long) "jvm object cast" ("jvm long =" ("jvm object cast" (as java/lang/Long expected)))))))) + (|>> (as java/lang/Long) .jvm_object_cast# (.jvm_long_=# (.jvm_object_cast# (as java/lang/Long expected)))))))) (_.context "float" (array (/.newarray /instruction.t_float) ..valid_float $Float::literal [/.fastore /.faload $Float::wrap] (function (_ expected) @@ -1017,7 +1017,7 @@ (|>> (as java/lang/Float) ("jvm feq" expected)) @.jvm - (|>> (as java/lang/Float) "jvm object cast" ("jvm float =" ("jvm object cast" (as java/lang/Float expected)))))))) + (|>> (as java/lang/Float) .jvm_object_cast# (.jvm_float_=# (.jvm_object_cast# (as java/lang/Float expected)))))))) (_.context "double" (array (/.newarray /instruction.t_double) ..valid_double $Double::literal [/.dastore /.daload $Double::wrap] (function (_ expected) @@ -1025,7 +1025,7 @@ (|>> (as java/lang/Double) ("jvm deq" expected)) @.jvm - (|>> (as java/lang/Double) "jvm object cast" ("jvm double =" ("jvm object cast" (as java/lang/Double expected)))))))) + (|>> (as java/lang/Double) .jvm_object_cast# (.jvm_double_=# (.jvm_object_cast# (as java/lang/Double expected)))))))) (_.context "char" (array (/.newarray /instruction.t_char) $Character::random $Character::literal [/.castore /.caload $Character::wrap] (function (_ expected) @@ -1033,7 +1033,7 @@ (|>> (as java/lang/Character) ("jvm ceq" expected)) @.jvm - (|>> (as java/lang/Character) "jvm object cast" ("jvm char =" ("jvm object cast" (as java/lang/Character expected)))))))) + (|>> (as java/lang/Character) .jvm_object_cast# (.jvm_char_=# (.jvm_object_cast# (as java/lang/Character expected)))))))) (_.context "object" (array (/.anewarray ..$String) $String::random $String::literal [/.aastore /.aaload /.nop] (function (_ expected) (|>> (as Text) (text#= (as Text expected)))))) @@ -1068,7 +1068,7 @@ (|>> (as <type>) (<old> expected)) @.jvm - (|>> (as <type>) "jvm object cast" (<new> ("jvm object cast" (as <type> expected)))))))])) + (|>> (as <type>) .jvm_object_cast# (<new> (.jvm_object_cast# (as <type> expected)))))))])) (def conversion Test @@ -1083,10 +1083,10 @@ [_ ((the #literal from) input) _ instruction] (the #wrap to)))))) - int::= (!::= java/lang/Integer "jvm ieq" "jvm int =") - long::= (!::= java/lang/Long "jvm leq" "jvm long =") - float::= (!::= java/lang/Float "jvm feq" "jvm float =") - double::= (!::= java/lang/Double "jvm deq" "jvm double =")] + int::= (!::= java/lang/Integer "jvm ieq" .jvm_int_=#) + long::= (!::= java/lang/Long "jvm leq" .jvm_long_=#) + float::= (!::= java/lang/Float "jvm feq" .jvm_float_=#) + double::= (!::= java/lang/Double "jvm deq" .jvm_double_=#)] (all _.and (<| (_.context "int") (all _.and @@ -1099,16 +1099,16 @@ (|>> (as java/lang/Byte) ffi.byte_to_long ("jvm leq" (ffi.byte_to_long expected))) @.jvm - (|>> (as java/lang/Byte) ffi.byte_to_long "jvm object cast" ("jvm long =" ("jvm object cast" (ffi.byte_to_long (as java/lang/Byte expected))))))))) + (|>> (as java/lang/Byte) ffi.byte_to_long .jvm_object_cast# (.jvm_long_=# (.jvm_object_cast# (ffi.byte_to_long (as java/lang/Byte expected))))))))) (_.lifted "I2C" (conversion ..$Integer::primitive ..$Character::primitive /.i2c (|>> ffi.int_to_char) - (!::= java/lang/Character "jvm ceq" "jvm char ="))) + (!::= java/lang/Character "jvm ceq" .jvm_char_=#))) (_.lifted "I2S" (conversion ..$Integer::primitive ..$Short::primitive /.i2s (|>> ffi.int_to_short) (function (_ expected) (for @.old (|>> (as java/lang/Short) ffi.short_to_long ("jvm leq" (ffi.short_to_long expected))) @.jvm - (|>> (as java/lang/Short) ffi.short_to_long "jvm object cast" ("jvm long =" ("jvm object cast" (ffi.short_to_long (as java/lang/Short expected))))))))))) + (|>> (as java/lang/Short) ffi.short_to_long .jvm_object_cast# (.jvm_long_=# (.jvm_object_cast# (ffi.short_to_long (as java/lang/Short expected))))))))))) (<| (_.context "long") (all _.and (_.lifted "L2I" (conversion ..$Long::primitive ..$Integer::primitive /.l2i (|>> ffi.long_to_int) int::=)) @@ -1162,7 +1162,7 @@ *wrap)))))] (all _.and (<| (_.context "int") - (let [test (!::= java/lang/Integer "jvm ieq" "jvm int =")] + (let [test (!::= java/lang/Integer "jvm ieq" .jvm_int_=#)] (all _.and (_.lifted "ISTORE_0/ILOAD_0" (store_and_load ..$Integer::random ..$Integer::literal ..$Integer::wrap [(function.constant /.istore_0) (function.constant /.iload_0)] test)) @@ -1186,10 +1186,9 @@ (.int (/unsigned.value increment))) @.jvm - ("jvm object cast" - ("jvm long +" - ("jvm object cast" (ffi.byte_to_long base)) - ("jvm object cast" (as java/lang/Long (/unsigned.value increment)))))))]] + (.jvm_object_cast# + (.jvm_long_+# (.jvm_object_cast# (ffi.byte_to_long base)) + (.jvm_object_cast# (as java/lang/Long (/unsigned.value increment)))))))]] (..bytecode (|>> (as Int) (i.= (as Int expected))) (do /.monad [_ (..$Byte::literal base) @@ -1199,7 +1198,7 @@ _ /.i2l] ..$Long::wrap))))))) (<| (_.context "long") - (let [test (!::= java/lang/Long "jvm leq" "jvm long =")] + (let [test (!::= java/lang/Long "jvm leq" .jvm_long_=#)] (all _.and (_.lifted "LSTORE_0/LLOAD_0" (store_and_load ..$Long::random ..$Long::literal ..$Long::wrap [(function.constant /.lstore_0) (function.constant /.lload_0)] test)) @@ -1212,7 +1211,7 @@ (_.lifted "LSTORE/LLOAD" (store_and_load ..$Long::random ..$Long::literal ..$Long::wrap [/.lstore /.lload] test))))) (<| (_.context "float") - (let [test (!::= java/lang/Float "jvm feq" "jvm float =")] + (let [test (!::= java/lang/Float "jvm feq" .jvm_float_=#)] (all _.and (_.lifted "FSTORE_0/FLOAD_0" (store_and_load ..valid_float ..$Float::literal ..$Float::wrap [(function.constant /.fstore_0) (function.constant /.fload_0)] test)) @@ -1225,7 +1224,7 @@ (_.lifted "FSTORE/FLOAD" (store_and_load ..valid_float ..$Float::literal ..$Float::wrap [/.fstore /.fload] test))))) (<| (_.context "double") - (let [test (!::= java/lang/Double "jvm deq" "jvm double =")] + (let [test (!::= java/lang/Double "jvm deq" .jvm_double_=#)] (all _.and (_.lifted "DSTORE_0/DLOAD_0" (store_and_load ..valid_double ..$Double::literal ..$Double::wrap [(function.constant /.dstore_0) (function.constant /.dload_0)] test)) @@ -1359,26 +1358,26 @@ (list) (list) (list (/method.method ..method_modifier - primitive_method_name - false primitive_method_type - (list) - {.#Some (do /.monad - [_ ((the #literal primitive) expected)] - return)}) + primitive_method_name + false primitive_method_type + (list) + {.#Some (do /.monad + [_ ((the #literal primitive) expected)] + return)}) (/method.method ..method_modifier - object_method_name - false (/type.method [(list) (list) (the #boxed primitive) (list)]) - (list) - {.#Some (do /.monad - [_ (/.invokestatic $Self primitive_method_name primitive_method_type) - _ (when substitute - {.#None} - (in []) - - {.#Some substitute} - (substitute expected)) - _ (the #wrap primitive)] - /.areturn)})) + object_method_name + false (/type.method [(list) (list) (the #boxed primitive) (list)]) + (list) + {.#Some (do /.monad + [_ (/.invokestatic $Self primitive_method_name primitive_method_type) + _ (when substitute + {.#None} + (in []) + + {.#Some substitute} + (substitute expected)) + _ (the #wrap primitive)] + /.areturn)})) (sequence.sequence)) .let [bytecode (binary.result /class.format class) loader (/loader.memory (/loader.new_library []))] @@ -1393,10 +1392,10 @@ false) ))))] (all _.and - (_.lifted "IRETURN" (primitive_return ..$Integer::primitive /.ireturn {.#None} (!::= java/lang/Integer "jvm ieq" "jvm int ="))) - (_.lifted "LRETURN" (primitive_return ..$Long::primitive /.lreturn {.#None} (!::= java/lang/Long "jvm leq" "jvm long ="))) - (_.lifted "FRETURN" (primitive_return ..$Float::primitive /.freturn {.#None} (!::= java/lang/Float "jvm feq" "jvm float ="))) - (_.lifted "DRETURN" (primitive_return ..$Double::primitive /.dreturn {.#None} (!::= java/lang/Double "jvm deq" "jvm double ="))) + (_.lifted "IRETURN" (primitive_return ..$Integer::primitive /.ireturn {.#None} (!::= java/lang/Integer "jvm ieq" .jvm_int_=#))) + (_.lifted "LRETURN" (primitive_return ..$Long::primitive /.lreturn {.#None} (!::= java/lang/Long "jvm leq" .jvm_long_=#))) + (_.lifted "FRETURN" (primitive_return ..$Float::primitive /.freturn {.#None} (!::= java/lang/Float "jvm feq" .jvm_float_=#))) + (_.lifted "DRETURN" (primitive_return ..$Double::primitive /.dreturn {.#None} (!::= java/lang/Double "jvm deq" .jvm_double_=#))) (_.lifted "ARETURN" (primitive_return ..$String::primitive /.areturn {.#None} (function (_ expected actual) (text#= (as Text expected) (as Text actual))))) (_.lifted "RETURN" (primitive_return (is (Primitive java/lang/String) [#unboxed /type.void @@ -1416,7 +1415,7 @@ dummy ..$Long::random .let [if! (is (-> (-> Label (Bytecode Any)) (Bytecode Any) (Random Bit)) (function (_ instruction prelude) - (<| (..bytecode ((!::= java/lang/Long "jvm leq" "jvm long =") expected)) + (<| (..bytecode ((!::= java/lang/Long "jvm leq" .jvm_long_=#) expected)) (do /.monad [@then /.new_label @end /.new_label @@ -1440,12 +1439,12 @@ (_.lifted "IFNONNULL" (if! /.ifnonnull (/.string ""))))] reference ..$Integer::random subject (|> ..$Integer::random - (random.only (|>> ((!::= java/lang/Integer "jvm ieq" "jvm int =") reference) not))) + (random.only (|>> ((!::= java/lang/Integer "jvm ieq" .jvm_int_=#) reference) not))) .let [[lesser greater] (if (for @.old ("jvm ilt" reference subject) @.jvm - ("jvm int <" ("jvm object cast" subject) ("jvm object cast" reference))) + (.jvm_int_<# (.jvm_object_cast# subject) (.jvm_object_cast# reference))) [reference subject] [subject reference]) int_comparison (all _.and @@ -1478,7 +1477,7 @@ dummy ..$Long::random .let [jump (is (-> (-> Label (Bytecode Any)) (Random Bit)) (function (_ goto) - (<| (..bytecode ((!::= java/lang/Long "jvm leq" "jvm long =") expected)) + (<| (..bytecode ((!::= java/lang/Long "jvm leq" .jvm_long_=#) expected)) (do /.monad [@skipped /.new_label @value /.new_label @@ -1505,7 +1504,7 @@ minimum (at ! each (|>> (n.% 100) .int /signed.s4 try.trusted) random.nat) afterwards (at ! each (n.% 10) random.nat)]) - (..bytecode ((!::= java/lang/Long "jvm leq" "jvm long =") expected)) + (..bytecode ((!::= java/lang/Long "jvm leq" .jvm_long_=#) expected)) (do /.monad [@right /.new_label @wrong /.new_label @@ -1531,7 +1530,7 @@ .let [choice (maybe.trusted (list.item choice options))] expected ..$Long::random dummy ..$Long::random]) - (..bytecode ((!::= java/lang/Long "jvm leq" "jvm long =") expected)) + (..bytecode ((!::= java/lang/Long "jvm leq" .jvm_long_=#) expected)) (do /.monad [@right /.new_label @wrong /.new_label @@ -1557,7 +1556,7 @@ dummy ..$Long::random exception ..$String::random] (<| (_.lifted "ATHROW") - (..bytecode ((!::= java/lang/Long "jvm leq" "jvm long =") expected)) + (..bytecode ((!::= java/lang/Long "jvm leq" .jvm_long_=#) expected)) (do /.monad [.let [$Exception (/type.class "java.lang.Exception" (list))] @skipped /.new_label @@ -1645,12 +1644,12 @@ method (is (-> Text java/lang/Long (Resource Method)) (function (_ name value) (/method.method /method.public - name - false method::type - (list) - {.#Some (do /.monad - [_ (..$Long::literal value)] - /.lreturn)}))) + name + false method::type + (list) + {.#Some (do /.monad + [_ (..$Long::literal value)] + /.lreturn)}))) interface_bytecode (|> (/class.class /version.v6_0 (all /modifier#composite /class.public /class.abstract /class.interface) (/name.internal interface_class) @@ -1659,7 +1658,7 @@ (list) (list) (list (/method.method (all /modifier#composite /method.public /method.abstract) - interface_method false method::type (list) {.#None})) + interface_method false method::type (list) {.#None})) (sequence.sequence)) try.trusted (binary.result /class.format)) @@ -1670,17 +1669,17 @@ (list) (list) (list (/method.method /method.public - "<init>" - false constructor::type - (list) - {.#Some (do /.monad - [_ /.aload_0 - _ (/.invokespecial ..$Object "<init>" constructor::type)] - /.return)}) + "<init>" + false constructor::type + (list) + {.#Some (do /.monad + [_ /.aload_0 + _ (/.invokespecial ..$Object "<init>" constructor::type)] + /.return)}) (method inherited_method part0) (method overriden_method fake_part2) (/method.method (all /modifier#composite /method.public /method.abstract) - abstract_method false method::type (list) {.#None})) + abstract_method false method::type (list) {.#None})) (sequence.sequence)) try.trusted (binary.result /class.format)) @@ -1696,13 +1695,13 @@ (list (/name.internal interface_class)) (list) (list (/method.method /method.public - "<init>" - false constructor::type - (list) - {.#Some (do /.monad - [_ /.aload_0 - _ (/.invokespecial $Abstract "<init>" constructor::type)] - /.return)}) + "<init>" + false constructor::type + (list) + {.#Some (do /.monad + [_ /.aload_0 + _ (/.invokespecial $Abstract "<init>" constructor::type)] + /.return)}) (method virtual_method part1) (method overriden_method part2) (method abstract_method part3) @@ -1710,25 +1709,25 @@ (/method.method (all /modifier#composite /method.public /method.static) - static_method - false (/type.method [(list) (list) ..$Long (list)]) - (list) - {.#Some (do /.monad - [_ (/.new $Concrete) - _ /.dup - _ (/.invokespecial $Concrete "<init>" constructor::type) - _ /.astore_0 - _ (invoke $Abstract inherited_method) - _ (invoke $Concrete virtual_method) - _ /.ladd - _ (invoke $Abstract overriden_method) - _ /.ladd - _ /.aload_0 _ (/.invokeinterface $Interface interface_method method::type) - _ /.ladd - _ (invoke $Abstract abstract_method) - _ /.ladd - _ ..$Long::wrap] - /.areturn)})) + static_method + false (/type.method [(list) (list) ..$Long (list)]) + (list) + {.#Some (do /.monad + [_ (/.new $Concrete) + _ /.dup + _ (/.invokespecial $Concrete "<init>" constructor::type) + _ /.astore_0 + _ (invoke $Abstract inherited_method) + _ (invoke $Concrete virtual_method) + _ /.ladd + _ (invoke $Abstract overriden_method) + _ /.ladd + _ /.aload_0 _ (/.invokeinterface $Interface interface_method method::type) + _ /.ladd + _ (invoke $Abstract abstract_method) + _ /.ladd + _ ..$Long::wrap] + /.areturn)})) (sequence.sequence)) try.trusted (binary.result /class.format)) diff --git a/stdlib/source/test/lux/world/net.lux b/stdlib/source/test/lux/world/net.lux index a6d74f5c6..29427d6c3 100644 --- a/stdlib/source/test/lux/world/net.lux +++ b/stdlib/source/test/lux/world/net.lux @@ -12,7 +12,8 @@ ["[0]" / ["[1][0]" http ["[1]/[0]" client] - ["[1]/[0]" status]]]) + ["[1]/[0]" status] + ["[1]/[0]" version]]]) (def .public test Test @@ -31,4 +32,5 @@ /http/client.test /http/status.test + /http/version.test ))) diff --git a/stdlib/source/test/lux/world/net/http/version.lux b/stdlib/source/test/lux/world/net/http/version.lux new file mode 100644 index 000000000..f005e944b --- /dev/null +++ b/stdlib/source/test/lux/world/net/http/version.lux @@ -0,0 +1,48 @@ +(.require + [library + [lux (.except) + [abstract + [monad (.only do)] + [\\specification + ["$[0]" equivalence] + ["$[0]" hash]]] + [data + [collection + ["[0]" list] + ["[0]" set]]] + [math + ["[0]" random (.only Random) (.use "[1]#[0]" monad)] + [number + ["n" nat]]] + [test + ["_" property (.only Test)]]]] + [\\library + ["[0]" /]]) + +(def .public random + (Random /.Version) + (all random.or + (random#in /.v0_9) + (random#in /.v1_0) + (random#in /.v1_1) + (random#in /.v2_0) + )) + +(def .public test + Test + (<| (_.covering /._) + (do [! random.monad] + []) + (_.for [/.Version]) + (all _.and + (_.for [/.equivalence] + ($equivalence.spec /.equivalence ..random)) + (_.for [/.hash] + ($hash.spec /.hash ..random)) + + (_.coverage [/.v0_9 /.v1_0 /.v1_1 /.v2_0] + (let [options (list /.v0_9 /.v1_0 /.v1_1 /.v2_0) + uniques (set.empty /.hash options)] + (n.= (list.size options) + (set.size uniques)))) + ))) |