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.

66 lines
1.6 KiB

  1. #! /usr/bin/env escript
  2. % This file is part of Jiffy released under the MIT license.
  3. % See the LICENSE file for more information.
  4. main([]) ->
  5. code:add_pathz("ebin"),
  6. code:add_pathz("test"),
  7. etap:plan(59),
  8. util:test_good(good()),
  9. util:test_errors(errors()),
  10. etap:end_tests().
  11. good() ->
  12. [
  13. {<<"0">>, 0},
  14. {<<"-0">>, 0, <<"0">>},
  15. {<<"1">>, 1},
  16. {<<"12">>, 12},
  17. {<<"-3">>, -3},
  18. {<<"1234567890123456789012345">>, 1234567890123456789012345},
  19. {<<"1310050760199">>, 1310050760199},
  20. {
  21. 1.23456789012345678e24
  22. },
  23. {
  24. 1.2345678901234569e27
  25. },
  26. {
  27. <<"1234567890123456789012345012">>,
  28. 1234567890123456789012345012
  29. },
  30. {<<"1.0">>, 1.0},
  31. {
  32. <<"0.000000000000000000000000000000000001">>,
  33. 1.0E-36,
  34. <<"1e-36">>
  35. },
  36. {<<"0.75">>, 0.75},
  37. {2.0123456789},
  38. {2.4234324E24},
  39. {-3.1416},
  40. {<<"1E4">>, 10000.0, <<"10000.0">>},
  41. {<<"1.0E+01">>, 10.0, <<"10.0">>},
  42. {<<"1e1">>, 10.0, <<"10.0">>},
  43. {<<"3.0E2">>, 300.0, <<"300.0">>},
  44. {<<"0E3">>, 0.0, <<"0.0">>},
  45. {<<"1.5E3">>, 1500.0, <<"1500.0">>},
  46. {<<"2.5E-1">>, 0.25, <<"0.25">>},
  47. {<<"-0.325E+2">>, -32.5, <<"-32.5">>}
  48. ].
  49. errors() ->
  50. [
  51. <<"02">>,
  52. <<"-01">>,
  53. <<"+12">>,
  54. <<"-">>,
  55. <<"1.">>,
  56. <<".1">>,
  57. <<"1.-1">>,
  58. <<"1E">>,
  59. <<"1-E2">>,
  60. <<"2E +3">>,
  61. <<"1EA">>
  62. ].