(check-expect (uniparse "abc") '(success () (normalize-unit 'abc))) (check-expect (uniparse "234") '(success () (make-numeric-quantity 234))) (check-expect (uniparse "abc^234") '(success () (power (normalize-unit 'abc) 234))) (check-expect (uniparse "234^567") '(success () (power (make-numeric-quantity 234) 567))) (check-expect (uniparse "abc+de") '(success () (add (normalize-unit 'abc) (normalize-unit 'de)))) (check-expect (uniparse "abc-de") '(success () (subtract (normalize-unit 'abc) (normalize-unit 'de)))) (check-expect (uniparse "abc+de+fg") '(success () (add (add (normalize-unit 'abc) (normalize-unit 'de)) (normalize-unit 'fg)))) (check-expect (uniparse "abc+de-fg") '(success () (subtract (add (normalize-unit 'abc) (normalize-unit 'de)) (normalize-unit 'fg)))) (check-expect (uniparse "abc-de+fg") '(success () (add (subtract (normalize-unit 'abc) (normalize-unit 'de)) (normalize-unit 'fg)))) (check-expect (uniparse "(abc)") '(success () (normalize-unit 'abc))) (check-expect (uniparse "(abc*def)") '(success () (multiply (normalize-unit 'abc) (normalize-unit 'def)))) (check-expect (uniparse "(abc/def)") '(success () (divide (normalize-unit 'abc) (normalize-unit 'def)))) (check-expect (uniparse "(abc*def*gh)") '(success () (multiply (multiply (normalize-unit 'abc) (normalize-unit 'def)) (normalize-unit 'gh)))) (check-expect (uniparse "(abc/def*gh)") '(success () (multiply (divide (normalize-unit 'abc) (normalize-unit 'def)) (normalize-unit 'gh)))) (check-expect (uniparse "(abc*def/gh)") '(success () (divide (multiply (normalize-unit 'abc) (normalize-unit 'def)) (normalize-unit 'gh)))) (check-expect (uniparse "(abc def/gh)") '(success () (divide (multiply (normalize-unit 'abc) (normalize-unit 'def)) (normalize-unit 'gh)))) (check-expect (uniparse "(abc+def/gh)") '(success () (add (normalize-unit 'abc) (divide (normalize-unit 'def) (normalize-unit 'gh))))) (check-expect (uniparse "(abc/def+gh)") '(success () (add (divide (normalize-unit 'abc) (normalize-unit 'def)) (normalize-unit 'gh)))) (check-expect (uniparse "((abc))") '(success () (normalize-unit 'abc))) (check-expect (uniparse "(((abc)))") '(success () (normalize-unit 'abc))) (check-expect (uniparse "((abc)def)") '(success () (multiply (normalize-unit 'abc) (normalize-unit 'def)))) (check-expect (uniparse "abc def^234 gh") '(success () (multiply (multiply (normalize-unit 'abc) (power (normalize-unit 'def) 234)) (normalize-unit 'gh)))) (check-expect (uniparse "abc+def") '(success () (add (normalize-unit 'abc) (normalize-unit 'def)))) (check-expect (uniparse "abc+def+gh") '(success () (add (add (normalize-unit 'abc) (normalize-unit 'def)) (normalize-unit 'gh)))) (check-expect (uniparse "abc+def-gh") '(success () (subtract (add (normalize-unit 'abc) (normalize-unit 'def)) (normalize-unit 'gh)))) (check-expect (uniparse "abc-def+gh") '(success () (add (subtract (normalize-unit 'abc) (normalize-unit 'def)) (normalize-unit 'gh)))) (check-expect (uniparse "abc-def-gh") '(success () (subtract (subtract (normalize-unit 'abc) (normalize-unit 'def)) (normalize-unit 'gh)))) (check-expect (uniparse "abc+def*gh") '(success () (add (normalize-unit 'abc) (multiply (normalize-unit 'def) (normalize-unit 'gh))))) (check-expect (uniparse "abc*def+gh") '(success () (add (multiply (normalize-unit 'abc) (normalize-unit 'def)) (normalize-unit 'gh)))) (check-expect (uniparse "abc*def+gh*ijk") '(success () (add (multiply (normalize-unit 'abc) (normalize-unit 'def)) (multiply (normalize-unit 'gh) (normalize-unit 'ijk))))) (check-expect (uniparse "abc/def+gh*ijk") '(success () (add (divide (normalize-unit 'abc) (normalize-unit 'def)) (multiply (normalize-unit 'gh) (normalize-unit 'ijk))))) (check-expect (uniparse "abc+def/gh*ijk") '(success () (add (normalize-unit 'abc) (multiply (divide (normalize-unit 'def) (normalize-unit 'gh)) (normalize-unit 'ijk))))) (check-expect (uniparse "abc+def/gh+ijk") '(success () (add (add (normalize-unit 'abc) (divide (normalize-unit 'def) (normalize-unit 'gh))) (normalize-unit 'ijk)))) (check-expect (uniparse "abc def^234") '(success () (multiply (normalize-unit 'abc) (power (normalize-unit 'def) 234)))) (check-expect (uniparse "abc+def/gh^234") '(success () (add (normalize-unit 'abc) (divide (normalize-unit 'def) (power (normalize-unit 'gh) 234))))) ; tests with extra whitespace (check-expect (uniparse "abc ") '(success () (normalize-unit 'abc))) (check-expect (uniparse " abc") '(success () (normalize-unit 'abc))) (check-expect (uniparse "abc de") '(success () (multiply (normalize-unit 'abc) (normalize-unit 'de)))) (check-expect (uniparse "abc de") '(success () (multiply (normalize-unit 'abc) (normalize-unit 'de)))) (check-expect (uniparse "abc +de") '(success () (add (normalize-unit 'abc) (normalize-unit 'de)))) (check-expect (uniparse "abc+ de") '(success () (add (normalize-unit 'abc) (normalize-unit 'de)))) (check-expect (uniparse "abc -de") '(success () (subtract (normalize-unit 'abc) (normalize-unit 'de)))) (check-expect (uniparse "abc- de") '(success () (subtract (normalize-unit 'abc) (normalize-unit 'de)))) (check-expect (uniparse "(abc def/gh )") '(success () (divide (multiply (normalize-unit 'abc) (normalize-unit 'def)) (normalize-unit 'gh)))) (check-expect (uniparse "(abc def/ gh)") '(success () (divide (multiply (normalize-unit 'abc) (normalize-unit 'def)) (normalize-unit 'gh)))) (check-expect (uniparse "(abc def /gh)") '(success () (divide (multiply (normalize-unit 'abc) (normalize-unit 'def)) (normalize-unit 'gh)))) (check-expect (uniparse "( abc def g h i)") '(success () (multiply (multiply (multiply (multiply (normalize-unit 'abc) (normalize-unit 'def)) (normalize-unit 'g)) (normalize-unit 'h)) (normalize-unit 'i)))) (check-expect (uniparse "( (abc)(def))") '(success () (multiply (normalize-unit 'abc) (normalize-unit 'def)))) (check-expect (uniparse "( (abc) (def) )") '(success () (multiply (normalize-unit 'abc) (normalize-unit 'def)))) (check-expect (uniparse "((abc) def)") '(success () (multiply (normalize-unit 'abc) (normalize-unit 'def)))) (check-expect (uniparse "((abc) (def))") '(success () (multiply (normalize-unit 'abc) (normalize-unit 'def)))) (check-expect (uniparse "abc^ 234") '(success () (power (normalize-unit 'abc) 234))) (check-expect (uniparse "abc ^234") '(success () (power (normalize-unit 'abc) 234))) (check-expect (uniparse "abc ^ 234") '(success () (power (normalize-unit 'abc) 234)))