private/lw-test.ss
(module lw-test mzscheme
  (require "test-util.ss"
           "loc-wrapper.ss"
           "lw-test-util.ss")
  
  (reset-count)
  
  (test (normalize-lw (to-loc-wrapper ()))
        (build-loc-wrapper (list (build-loc-wrapper "(" 0 0 0 1)
                                 (build-loc-wrapper ")" 0 0 1 1))
                           0 0 0 2))
  
  (test (normalize-lw (to-loc-wrapper/uq ()))
        (make-loc-wrapper (list (make-loc-wrapper "(" 0 0 0 1 #t #f)
                                (make-loc-wrapper ")" 0 0 1 1 #t #f))
                          0 0 0 2 #t #f))
  
  (test (normalize-lw (to-loc-wrapper (a)))
        (build-loc-wrapper (list (build-loc-wrapper "(" 0 0 0 1)
                                 (build-loc-wrapper 'a 0 0 1 1)
                                 (build-loc-wrapper ")" 0 0 2 1))
                           0 0 0 3))
  
  (test (normalize-lw (to-loc-wrapper (a
                                       b)))
        (build-loc-wrapper (list (build-loc-wrapper "(" 0 0 0 1)
                                 (build-loc-wrapper 'a 0 0 1 1)
                                 (build-loc-wrapper 'b 1 0 1 1)
                                 (build-loc-wrapper ")" 1 0 2 1))
                           0 1 0 3))
  
  (test (normalize-lw (to-loc-wrapper (a
                                       (b c)
                                       d)))
        (build-loc-wrapper (list (build-loc-wrapper "(" 0 0 0 1)
                                 (build-loc-wrapper 'a 0 0 1 1)
                                 (build-loc-wrapper 
                                  (list (build-loc-wrapper "(" 1 0 1 1)
                                        (build-loc-wrapper 'b 1 0 2 1)
                                        (build-loc-wrapper 'c 1 0 4 1)
                                        (build-loc-wrapper ")" 1 0 5 1))
                                  1 0 1 5)
                                 (build-loc-wrapper 'd 2 0 1 1)
                                 (build-loc-wrapper ")" 2 0 2 1))
                           0 2 0 3))
  
  (test (normalize-lw (to-loc-wrapper (abcdefghijkl
                                       b)))
        (build-loc-wrapper (list (build-loc-wrapper "(" 0 0 0 1)
                                 (build-loc-wrapper 'abcdefghijkl 0 0 1 12)
                                 (build-loc-wrapper 'b 1 0 1 1)
                                 (build-loc-wrapper ")" 1 0 2 1))
                           0 1 0 3))
  
  (test (normalize-lw (to-loc-wrapper ((a b)
                                       c)))
        (build-loc-wrapper (list (build-loc-wrapper "(" 0 0 0 1)
                                 (build-loc-wrapper 
                                  (list (build-loc-wrapper "(" 0 0 1 1)
                                        (build-loc-wrapper 'a 0 0 2 1)
                                        (build-loc-wrapper 'b 0 0 4 1)
                                        (build-loc-wrapper ")" 0 0 5 1))
                                  0 0 1 5)
                                 (build-loc-wrapper 'c 1 0 1 1)
                                 (build-loc-wrapper ")" 1 0 2 1))
                           0 1 0 3))
  
  
  (test (normalize-lw (to-loc-wrapper ([{}])))
        (build-loc-wrapper (list (build-loc-wrapper "(" 0 0 0 1)
                                 (build-loc-wrapper
                                  (list
                                   (build-loc-wrapper "[" 0 0 1 1)
                                   (build-loc-wrapper
                                    (list
                                     (build-loc-wrapper "{" 0 0 2 1)
                                     (build-loc-wrapper "}" 0 0 3 1))
                                    0 0 2 2)
                                   (build-loc-wrapper "]" 0 0 4 1))
                                  0 0 1 4)
                                 (build-loc-wrapper ")" 0 0 5 1))
                           0 0 0 6))
  
  (test (normalize-lw (to-loc-wrapper ,x))
        (make-loc-wrapper
         (list 
          (make-loc-wrapper "" 0 0 0 0 #f #f)
          'spring
          (make-loc-wrapper 'x 0 0 1 1 #t #f))
         0 0 0 2 #f #f))
  
  (test (normalize-lw (to-loc-wrapper ,@x))
        (make-loc-wrapper
         (list 
          (make-loc-wrapper "" 0 0 0 0 #f #f)
          'spring
          (make-loc-wrapper 'x 0 0 2 1 #t #f))
         0 0 0 3 #f #f))
  
  (test (normalize-lw (to-loc-wrapper 'x))
        (make-loc-wrapper
         (list 
          (make-loc-wrapper "" 0 0 0 0 #f #f)
          'spring
          (make-loc-wrapper 'x 0 0 1 1 #f #f))
         0 0 0 2 #f #f))
  
  (test (normalize-lw (to-loc-wrapper ,(term x)))
        (make-loc-wrapper
         (list 
          (make-loc-wrapper "" 0 0 0 0 #f #f)
          'spring
          (make-loc-wrapper
           (list 
            (make-loc-wrapper "" 0 0 1 0 #t #f) 
            'spring
            (make-loc-wrapper 'x 0 0 7 1 #f #f)
            'spring)
           0 0 1 7 #t #f))
         0 0 0 8 #f #f))
  
  (print-tests-passed "lw-test.ss"))