Browse code
Add missing files
Showing 2 changed files
0 | 7 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,68 @@ |
1 |
+(in-package :fwoar.string-utils) |
|
2 |
+ |
|
3 |
+(defun vos-equal (a b) |
|
4 |
+ (every 'equal a b)) |
|
5 |
+ |
|
6 |
+(progn |
|
7 |
+ (st:deftest string-split-as-expected-with-test () |
|
8 |
+ (st:should be vos-equal |
|
9 |
+ #("a" "a" "a" "a") |
|
10 |
+ (%split-on-string "b" "abababa" :test #'string-equal))) |
|
11 |
+ (st:deftest string-split-as-expected-with-count () |
|
12 |
+ (st:should be vos-equal |
|
13 |
+ #("a" "b c d") |
|
14 |
+ (%split-on-string " " "a b c d" :count 2))) |
|
15 |
+ (st:deftest string-split-as-expected-with-consecutive-sep () |
|
16 |
+ (st:should be vos-equal |
|
17 |
+ #("a" "b" "" "c" "d") |
|
18 |
+ (%split-on-string " " "a b c d"))) |
|
19 |
+ (st:deftest string-split-as-expected-with-leading-and-trailing-sep () |
|
20 |
+ (st:should be vos-equal |
|
21 |
+ #("" "a" "b" "c" "d" "") |
|
22 |
+ (%split-on-string " " " a b c d "))) |
|
23 |
+ (st:deftest string-split-as-expected-with-leading-sep () |
|
24 |
+ (st:should be vos-equal |
|
25 |
+ #("" "a" "b" "c" "d") |
|
26 |
+ (%split-on-string " " " a b c d"))) |
|
27 |
+ (st:deftest string-split-as-expected-with-trailing-sep () |
|
28 |
+ (st:should be vos-equal |
|
29 |
+ #("a" "b" "c" "d" "") |
|
30 |
+ (%split-on-string " " "a b c d "))) |
|
31 |
+ (st:deftest string-split-multichar-as-expected () |
|
32 |
+ (st:should be vos-equal |
|
33 |
+ #("a" "b" "c" "d") |
|
34 |
+ (%split-on-string " " "a b c d"))) |
|
35 |
+ (st:deftest string-split-as-expected () |
|
36 |
+ (st:should be vos-equal |
|
37 |
+ #("a" "b" "c" "d") |
|
38 |
+ (%split-on-string " " "a b c d"))) |
|
39 |
+ |
|
40 |
+ (st:deftest char-split-as-expected-with-test () |
|
41 |
+ (st:should be vos-equal |
|
42 |
+ #("a" "a" "a" "a") |
|
43 |
+ (%split-on-char #\b "abababa" :test #'char-equal))) |
|
44 |
+ (st:deftest char-split-as-expected-with-count () |
|
45 |
+ (st:should be vos-equal |
|
46 |
+ #("a" "b c d") |
|
47 |
+ (%split-on-char #\space "a b c d" :count 2))) |
|
48 |
+ (st:deftest char-split-as-expected-with-consecutive-sep () |
|
49 |
+ (st:should be vos-equal |
|
50 |
+ #("a" "b" "" "c" "d") |
|
51 |
+ (%split-on-char #\space "a b c d"))) |
|
52 |
+ (st:deftest char-split-as-expected-with-leading-and-trailing-sep () |
|
53 |
+ (st:should be vos-equal |
|
54 |
+ #("" "a" "b" "c" "d" "") |
|
55 |
+ (%split-on-char #\space " a b c d "))) |
|
56 |
+ (st:deftest char-split-as-expected-with-leading-sep () |
|
57 |
+ (st:should be vos-equal |
|
58 |
+ #("" "a" "b" "c" "d") |
|
59 |
+ (%split-on-char #\space " a b c d"))) |
|
60 |
+ (st:deftest char-split-as-expected-with-trailing-sep () |
|
61 |
+ (st:should be vos-equal |
|
62 |
+ #("a" "b" "c" "d" "") |
|
63 |
+ (%split-on-char #\space "a b c d "))) |
|
64 |
+ (st:deftest char-split-as-expected () |
|
65 |
+ (st:should be vos-equal |
|
66 |
+ #("a" "b" "c" "d") |
|
67 |
+ (%split-on-char #\space "a b c d"))) |
|
68 |
+ ) |