assert "string's value pattern"
  (match "abc" as string with
    | #"abc" -> True
    | _ -> False)

assert "string's nil"
  (match "" as string with
    | [] -> True
    | _ -> False)

assert "string's nil"
  (match "abc" as string with
    | [] -> False
    | _ -> True)

assertEqual "string's cons"
  (matchAll "abc" as string with
    | $x :: $xs -> (x, xs))
  [('a', "bc")]

assertEqual "string's join"
  (matchAll "abc" as string with
    | $xs ++ $ys -> (xs, ys))
  [("", "abc"), ("a", "bc"), ("ab", "c"), ("abc", "")]

--
-- String as collection
--
assertEqual "S.isEmpty" (S.isEmpty "") True

assertEqual "S.isEmpty" (S.isEmpty "Egison") False

assertEqual "S.head" (S.head "Egison") 'E'

assertEqual "S.tail" (S.tail "Egison") "gison"

assertEqual "S.last" (S.last "Egison") 'n'

assertEqual "S.map" (S.map id "Egison") "Egison"

assertEqual "S.length" (S.length "Egison") 6

assertEqual "S.split"
  (S.split "," "Lisp,Haskell,Egison")
  ["Lisp", "Haskell", "Egison"]

assertEqual "S.append" (S.append "Egi" "son") "Egison"

assertEqual "S.concat" (S.concat ["Egi", "son"]) "Egison"

assertEqual "S.intercalate"
  (S.intercalate "," ["Lisp", "Haskell", "Egison"])
  "Lisp,Haskell,Egison"

--
-- Characters
--

assertEqual "C.between" (C.between 'a' 'c') ['a', 'b', 'c']

assertEqual "C.isBetween" (C.isBetween 'a' 'c' 'b') True

assertEqual "isAlphabet" (isAlphabet 'a') True

assertEqual "isAlphabetString" (isAlphabetString "Egison") True

assertEqual "upper-case" (upperCase 'e') 'E'

assertEqual "lower-case" (lowerCase 'E') 'e'
