From 44cff1dcbd6cd23ef455923b707104302dde1aad Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Wed, 23 Nov 2022 20:35:07 -0400 Subject: New arithmetic abstraction + common file extensions as constants. --- stdlib/source/test/lux/math/number/complex.lux | 6 +- stdlib/source/test/lux/math/number/frac.lux | 6 +- stdlib/source/test/lux/math/number/int.lux | 6 +- stdlib/source/test/lux/math/number/nat.lux | 6 +- stdlib/source/test/lux/math/number/ratio.lux | 6 +- stdlib/source/test/lux/math/number/rev.lux | 6 +- stdlib/source/test/lux/world/file.lux | 4 +- stdlib/source/test/lux/world/file/extension.lux | 148 ++++++++++++++++++++++++ 8 files changed, 181 insertions(+), 7 deletions(-) create mode 100644 stdlib/source/test/lux/world/file/extension.lux (limited to 'stdlib/source/test') diff --git a/stdlib/source/test/lux/math/number/complex.lux b/stdlib/source/test/lux/math/number/complex.lux index 2b8eada59..18fbdd28e 100644 --- a/stdlib/source/test/lux/math/number/complex.lux +++ b/stdlib/source/test/lux/math/number/complex.lux @@ -9,7 +9,9 @@ [collection ["[0]" list (.use "[1]#[0]" functor)]]] [math - ["[0]" random (.only Random)]] + ["[0]" random (.only Random)] + ["[0]" arithmetic + ["[1]S" \\specification]]] [test ["_" property (.only Test)]]]] [\\library @@ -272,6 +274,8 @@ (all _.and (_.for [/.= /.equivalence] ($equivalence.spec /.equivalence ..random)) + (_.for [/.arithmetic] + (arithmeticS.spec /.equivalence /.arithmetic ..random)) ..construction ..constant diff --git a/stdlib/source/test/lux/math/number/frac.lux b/stdlib/source/test/lux/math/number/frac.lux index 9d6844441..673b04276 100644 --- a/stdlib/source/test/lux/math/number/frac.lux +++ b/stdlib/source/test/lux/math/number/frac.lux @@ -13,7 +13,9 @@ [data ["[0]" bit (.use "[1]#[0]" equivalence)]] [math - ["[0]" random (.only Random)]] + ["[0]" random (.only Random)] + ["[0]" arithmetic + ["[1]S" \\specification]]] [meta ["@" target] [macro @@ -120,6 +122,8 @@ [/.binary] [/.octal] [/.decimal] [/.hex] )) + (_.for [/.arithmetic] + (arithmeticS.spec /.equivalence /.arithmetic random.safe_frac)) ))) (with_expansions [ (these (ffi.import java/lang/Double diff --git a/stdlib/source/test/lux/math/number/int.lux b/stdlib/source/test/lux/math/number/int.lux index afb733787..46c2739e3 100644 --- a/stdlib/source/test/lux/math/number/int.lux +++ b/stdlib/source/test/lux/math/number/int.lux @@ -14,7 +14,9 @@ [data ["[0]" bit (.use "[1]#[0]" equivalence)]] [math - ["[0]" random (.only Random)]] + ["[0]" random (.only Random)] + ["[0]" arithmetic + ["[1]S" \\specification]]] [test ["_" property (.only Test)]]]] [\\library @@ -53,6 +55,8 @@ [/.binary] [/.octal] [/.decimal] [/.hex] )) + (_.for [/.arithmetic] + (arithmeticS.spec /.equivalence /.arithmetic random.int)) ))) (def predicate diff --git a/stdlib/source/test/lux/math/number/nat.lux b/stdlib/source/test/lux/math/number/nat.lux index 9ab7e63fb..aecbccf81 100644 --- a/stdlib/source/test/lux/math/number/nat.lux +++ b/stdlib/source/test/lux/math/number/nat.lux @@ -14,7 +14,9 @@ [data ["[0]" bit (.use "[1]#[0]" equivalence)]] [math - ["[0]" random]] + ["[0]" random] + ["[0]" arithmetic + ["[1]S" \\specification]]] [test ["_" property (.only Test)]]]] [\\library @@ -51,6 +53,8 @@ [/.binary] [/.octal] [/.decimal] [/.hex] )) + (_.for [/.arithmetic] + (arithmeticS.spec /.equivalence /.arithmetic random.nat)) ))) (def predicate diff --git a/stdlib/source/test/lux/math/number/ratio.lux b/stdlib/source/test/lux/math/number/ratio.lux index 74c9a9ca7..d5062806c 100644 --- a/stdlib/source/test/lux/math/number/ratio.lux +++ b/stdlib/source/test/lux/math/number/ratio.lux @@ -13,7 +13,9 @@ [data ["[0]" bit (.use "[1]#[0]" equivalence)]] [math - ["[0]" random (.only Random)]] + ["[0]" random (.only Random)] + ["[0]" arithmetic + ["[1]S" \\specification]]] [test ["_" property (.only Test)]]]] [\\library @@ -53,6 +55,8 @@ )) (_.for [/.codec] ($codec.spec /.equivalence /.codec ..random)) + (_.for [/.arithmetic] + (arithmeticS.spec /.equivalence /.arithmetic ..random)) (do random.monad [.let [(open "#[0]") /.equivalence] diff --git a/stdlib/source/test/lux/math/number/rev.lux b/stdlib/source/test/lux/math/number/rev.lux index 6f5d6a4eb..724d0112a 100644 --- a/stdlib/source/test/lux/math/number/rev.lux +++ b/stdlib/source/test/lux/math/number/rev.lux @@ -14,7 +14,9 @@ [data ["[0]" bit (.use "[1]#[0]" equivalence)]] [math - ["[0]" random]] + ["[0]" random] + ["[0]" arithmetic + ["[1]S" \\specification]]] [test ["_" property (.only Test)]]]] [\\library @@ -52,6 +54,8 @@ [/.binary] [/.octal] [/.decimal] [/.hex] )) + (_.for [/.arithmetic] + (arithmeticS.spec /.equivalence /.arithmetic random.rev)) ))) (def .public test diff --git a/stdlib/source/test/lux/world/file.lux b/stdlib/source/test/lux/world/file.lux index 35402d81a..d2f3cde55 100644 --- a/stdlib/source/test/lux/world/file.lux +++ b/stdlib/source/test/lux/world/file.lux @@ -28,7 +28,8 @@ ["[0]" unit] ["_" property (.only Test)]]]] ["[0]" / - ["[1][0]" watch]] + ["[1][0]" watch] + ["[1][0]" extension]] [\\library ["[0]" /]] [\\specification @@ -288,4 +289,5 @@ false)))) /watch.test + /extension.test )))) diff --git a/stdlib/source/test/lux/world/file/extension.lux b/stdlib/source/test/lux/world/file/extension.lux new file mode 100644 index 000000000..428933939 --- /dev/null +++ b/stdlib/source/test/lux/world/file/extension.lux @@ -0,0 +1,148 @@ +(.require + [library + [lux (.except) + [abstract + [monad (.only do)]] + [data + ["[0]" text] + [collection + ["[0]" list] + ["[0]" set]]] + [math + ["[0]" random (.only Random)] + [number + ["n" nat]]] + [meta + [macro + ["[0]" template]]] + [test + ["_" property (.only Test)]]]] + [\\library + ["[0]" /]]) + +(with_expansions [ (these [/.compressed_7z_archive] + + [/.archive] + [/.advanced_audio_coding] + [/.agda_source_code] + [/.android_application_package] + [/.assembler_source_code] + + [/.binary] + [/.bzip2_archive] + [/.blender_project] + + [/.c_source_code] + [/.c++_source_code] + [/.java_class] + [/.dos_program] + [/.c#_source_code] + [/.css] + [/.comma_separated_values] + + [/.d_source_code] + [/.dart_source_code] + + [/.emacs_lisp_source_code] + [/.compiled_emacs_lisp_code] + [/.executable_and_linkable_file] + [/.electronic_publication] + [/.erlang_source_code] + [/.executable_program] + + [/.apophysis_fractal] + + [/.gps_exchange_format] + [/.gzip_compressed_data] + + [/.http_archive_format] + [/.c_header] + [/.html] + + [/.optical_disc_file_system] + + [/.java_archive] + [/.java_source_code] + [/.javascript_source_code] + [/.javascript_object_notation] + + [/.llvm_assembly] + [/.lua_source_code] + [/.lzip_archive] + + [/.markdown] + [/.musical_instrument_digital_interface] + + [/.object_code] + [/.vorbis_audio] + + [/.portable_document_format] + [/.php_source_code] + [/.maven_build_configuration] + [/.postscript_source_code] + [/.python_source_code] + + [/.ruby_source_code] + + [/.scheme_source_code] + [/.unix_shell_script] + [/.structured_query_language] + [/.scalable_vector_graphics] + + [/.tape_archive] + [/.temporary_file] + [/.tab_separated_values] + + [/.yaml] + + [/.zip_archive])] + (def .public test + Test + (<| (_.covering /._) + (do [! random.monad] + []) + (_.for [/.Extension]) + (`` (all _.and + (_.coverage [(,, (with_template [] + [] + + ))] + (let [options (list ) + uniques (set.of_list text.hash options)] + (n.= (list.size options) + (set.size uniques)))) + (,, (with_template [ ] + [(with_expansions [' (template.spliced )] + (`` (_.coverage [(,, (with_template [] + [] + + '))] + (and (,, (with_template [] + [(same? )] + + '))))))] + + [/.c_source_code [[/.c]]] + [/.c++_source_code [[/.c++]]] + [/.comma_separated_values [[/.csv]]] + [/.emacs_lisp_source_code [[/.emacs_lisp]]] + [/.erlang_source_code [[/.erlang]]] + [/.java_archive [[/.jar]]] + [/.java_source_code [[/.java]]] + [/.javascript_source_code [[/.javascript] [/.js]]] + [/.javascript_object_notation [[/.json]]] + [/.lua_source_code [[/.lua]]] + [/.musical_instrument_digital_interface [[/.midi]]] + [/.vorbis_audio [[/.ogg]]] + [/.portable_document_format [[/.pdf]]] + [/.php_source_code [[/.php]]] + [/.python_source_code [[/.python]]] + [/.ruby_source_code [[/.ruby]]] + [/.scheme_source_code [[/.scheme]]] + [/.structured_query_language [[/.sql]]] + [/.scalable_vector_graphics [[/.svg]]] + [/.tape_archive [[/.tar]]] + [/.yaml [[/.yet_another_markup_language] [/.yaml_ain't_markup_language]]] + [/.zip_archive [[/.zip]]] + )) + ))))) -- cgit v1.2.3