You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.1 KiB

  1. #! /usr/bin/env escript
  2. main([]) ->
  3. code:add_pathz("ebin"),
  4. code:add_pathz("test"),
  5. etap:plan(47),
  6. util:test_good(good()),
  7. util:test_errors(errors()),
  8. etap:end_tests().
  9. good() ->
  10. [
  11. {<<"0">>, 0},
  12. {<<"-0">>, 0, <<"0">>},
  13. {<<"1">>, 1},
  14. {<<"12">>, 12},
  15. {<<"-3">>, -3},
  16. {<<"309230948234098">>, 309230948234098},
  17. {<<"1.0">>, 1.0, <<"1">>},
  18. {<<"0.3">>, 0.3},
  19. {<<"2.4234324">>, 2.4234324, <<"2.42343">>},
  20. {<<"-3.1416">>, -3.1416},
  21. {<<"1E4">>, 10000.0, <<"10000">>},
  22. {<<"1.0E+01">>, 10.0, <<"10">>},
  23. {<<"1e1">>, 10.0, <<"10">>},
  24. {<<"3.0E2">>, 300.0, <<"300">>},
  25. {<<"0E3">>, 0.0, <<"0">>},
  26. {<<"1.5E3">>, 1500.0, <<"1500">>},
  27. {<<"1.5E-1">>, 0.15, <<"0.15">>},
  28. {<<"-0.323E+2">>, -32.3, <<"-32.3">>}
  29. ].
  30. errors() ->
  31. [
  32. <<"02">>,
  33. <<"-01">>,
  34. <<"+12">>,
  35. <<"-">>,
  36. <<"1.">>,
  37. <<".1">>,
  38. <<"1.-1">>,
  39. <<"1E">>,
  40. <<"1-E2">>,
  41. <<"2E +3">>,
  42. <<"1EA">>
  43. ].