test-rle.ss
(module test-rle mzscheme
  (require "rle.ss"
           (planet "test.ss" ("schematics" "schemeunit.plt" 2 6))
           (planet "text-ui.ss" ("schematics" "schemeunit.plt" 2 6)))
  
  (define rle-encode-tests
    (test-suite
     "rle-encode"
     
     (test-case
      "empty"
      (check-equal? (rle-encode "") '()))
     
     (test-case
      "1"
      (check-equal? (rle-encode "1") '((1 #\1))))
     
     (test-case
      "11"
      (check-equal? (rle-encode "11") '((2 #\1))))
     
     (test-case
      "011"
      (check-equal? (rle-encode "011") '((1 #\0) (2 #\1))))
     
     (test-case
      "0110"
      (check-equal? (rle-encode "0110") '((1 #\0) (2 #\1) (1 #\0))))
     
     (test-case
      "011000"
      (check-equal? (rle-encode "011000") '((1 #\0) (2 #\1) (3 #\0))))))
  
  
  (define rle-decode-tests
    (test-suite
     "rle-decode"
     (test-case
      "empty"
      (check-equal? (rle-decode '()) ""))
     
     (test-case
      "1"
      (check-equal? (rle-decode '((1 #\1))) "1"))
     
     (test-case
      "11"
      (check-equal? (rle-decode '((2 #\1))) "11"))
     
     (test-case
      "011"
      (check-equal? (rle-decode '((1 #\0) (2 #\1))) "011"))
     
     (test-case
      "0110"
      (check-equal? (rle-decode '((1 #\0) (2 #\1) (1 #\0))) "0110"))
     
     (test-case
      "011000"
      (check-equal? (rle-decode '((1 #\0) (2 #\1) (3 #\0))) "011000"))))
  
  
  (define rle-tests (test-suite "rle.ss" rle-encode-tests rle-decode-tests))
  
  (test/text-ui rle-tests))