aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/data/text/char.lux
blob: 3c19f277c89dd432ea5c562f32f26e8acb816d07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
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))
               ))))