aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/data/text/char.lux
diff options
context:
space:
mode:
authorEduardo Julian2022-10-24 16:58:07 -0400
committerEduardo Julian2022-10-24 16:58:07 -0400
commit45c599e49ae2659331d13222948f7e755967fdf9 (patch)
tree1f1b0be2423b69562d7479fd8db9abb509aaaf7f /stdlib/source/test/lux/data/text/char.lux
parent99d196a528804b3b136ac6c45cb872a5e7c70cde (diff)
New module just for the Char type + fixes to JSON parsing.
Diffstat (limited to 'stdlib/source/test/lux/data/text/char.lux')
-rw-r--r--stdlib/source/test/lux/data/text/char.lux83
1 files changed, 83 insertions, 0 deletions
diff --git a/stdlib/source/test/lux/data/text/char.lux b/stdlib/source/test/lux/data/text/char.lux
new file mode 100644
index 000000000..3c19f277c
--- /dev/null
+++ b/stdlib/source/test/lux/data/text/char.lux
@@ -0,0 +1,83 @@
+(.require
+ [library
+ [lux (.except)
+ [abstract
+ [monad (.only do)]]
+ [data
+ [collection
+ ["[0]" list]
+ ["[0]" set]]]
+ [math
+ ["[0]" random (.only Random)]
+ [number
+ ["[0]" nat]]]
+ [test
+ ["_" property (.only Test)]]]]
+ [\\library
+ ["[0]" /]])
+
+(def .public test
+ Test
+ (<| (_.covering /._)
+ (do [! random.monad]
+ [])
+ (_.for [/.Unicode /.Char])
+ (`` (all _.and
+ (with_expansions [<chars> (these /.null
+ /.alarm
+ /.back_space
+ /.tab
+ /.new_line
+ /.vertical_tab
+ /.form_feed
+ /.carriage_return
+ /.double_quote
+
+ /.start_of_heading
+ /.start_of_text
+ /.end_of_text
+ /.end_of_transmission
+ /.enquiry
+ /.acknowledgement
+ /.shift_out
+ /.shift_in
+ /.data_link_escape
+ /.device_control_1
+ /.device_control_2
+ /.device_control_3
+ /.device_control_4
+ /.negative_acknowledgement
+ /.synchronous_idle
+ /.end_of_transmission_block
+ /.cancel
+ /.end_of_medium
+ /.substitute
+ /.escape
+ /.file_separator
+ /.group_separator
+ /.record_separator
+ /.unit_separator
+ /.delete
+ )]
+ (_.coverage [<chars>]
+ (let [options (list <chars>)
+ uniques (set.of_list nat.hash options)]
+ (nat.= (list.size options)
+ (set.size uniques)))))
+ (,, (with_template [<short> <long>]
+ [(_.coverage [<short>]
+ (same? <long> <short>))]
+
+ [/.\0 /.null]
+ [/.\a /.alarm]
+ [/.\b /.back_space]
+ [/.\t /.tab]
+ [/.\n /.new_line]
+ [/.\v /.vertical_tab]
+ [/.\f /.form_feed]
+ [/.\r /.carriage_return]
+ [/.\'' /.double_quote]
+ ))
+ (_.coverage [/.line_feed]
+ (same? /.new_line /.line_feed))
+ ))))