; Unicalc API Tests Provided ; Relative to Version 2010 September 19, 10:07 PM ; Tests for normalize-unit (check-expect (normalize-unit 'second) '(1 (second)())) (check-expect (normalize-unit 'kilometer) '(1000 (meter) ())) (check-expect (normalize-unit 'gram) '(1/1000 (kg) ())) (check-expect (normalize-unit 'day) '(86400 (second) ())) (check-expect (normalize-unit 'newton) '(1 (kg meter) (second second))) (check-within (first (normalize-unit 'pound_force)) 4.44822162 1e-7) ; Tests for normalize (check-expect (normalize '(1 (minute)())) '(60 (second)())) (check-expect (normalize '(1 (hour)())) '(3600 (second)())) (check-expect (normalize '(1 (day)())) '(86400 (second)())) (check-expect (normalize '(1 (year)())) '(31536000 (second)())) (check-expect (normalize '(1 (fortnight)(week))) '(2 ()())) (check-expect (normalize '(1 (fortnight)())) '(1209600 (second)())) (check-expect (normalize '(1 (gram)(year))) '(1/31536000000 (kg) (second))) (check-expect (normalize '(1 (kg)(gram))) '(1000 ()())) (check-expect (normalize '(1 (weber)())) '(1 (kg meter meter) (ampere second second second second))) (check-expect (normalize '(1 (newton meter)(second))) '(1 (kg meter meter) (second second second))) (check-expect (normalize '(1 (volt)())) '(1 (kg meter meter) (ampere second second second))) (check-within (first (normalize '(1 (inch)(meter)))) 0.0254 1e-4) (check-within (first (normalize '(1 (foot)(meter)))) 0.3048 1e-5) (check-within (first (normalize '(1 (foot)(inch)))) 12 1e-8) (check-within (first (normalize '(1 (light_year)(inch)))) 3.72461748e+17 1e15) (check-within (first (normalize '(1 (btu)(calorie)))) 252 1e-1) (check-within (first (normalize '(1 (furlong)(meter)))) 201.164 .005) (check-within (first (normalize '(1 (mile)(hour)))) 0.44704 1e-5) (check-within (first (normalize '(1e6 (pound)(mile mile)))) 0.175133 1e-5) (check-within (first (normalize '(1 (fortnight meter)(furlong second)))) 6012.88475 1) ; Tests for multiply (check-expect (multiply '(1 () ()) '(1 (kg meter)(second))) '(1 (kg meter)(second))) (check-expect (multiply '(1 (chicken) (meter meter)) '(100 (meter meter) ())) '(100 (chicken) ())) (check-within (first (multiply (normalize '(1 (foot) ())) (normalize '(1 (acre) ())))) 1233.48184 .1) ; Tests for divide (check-expect (divide '(1 (meter)())'(1 (second)())) '(1 (meter)(second))) (check-within (first (multiply (normalize '(100 (tadpole) (gallon))) (normalize '(1 (meter meter meter) ())))) 26417.2 1) (check-within (first (divide (normalize '(1 (foot)())) (normalize '(1 (inch)())))) 12 1e-6) (check-within (first (divide (normalize '(1 (foot meter pound pound) (foot pound second))) (normalize '(1 (pound second second) (meter newton))))) 1 1e-4) (check-within (first (divide (normalize '(1 (yard)())) (normalize '(1 (foot)())))) 3.0 1e-10) (check-expect (divide (normalize '(1 (mile)())) (normalize '(1 (foot)()))) '(5280.0 () ()))