您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

71 行
2.0 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. <<"1234567890123456789012345.0">>,
  22. 1.23456789012345678e24,
  23. <<"1.2345678901234568245e+24">>
  24. },
  25. {
  26. <<"1234567890123456789012345.0E3">>,
  27. 1.2345678901234569e27,
  28. <<"1.2345678901234568502e+27">>
  29. },
  30. {
  31. <<"1234567890123456789012345E2">>,
  32. 123456789012345678901234500,
  33. <<"123456789012345678901234500">>
  34. },
  35. {
  36. <<"0.000000000000000000000000000000000001">>,
  37. 1.0E-36,
  38. <<"9.9999999999999994104e-37">>
  39. },
  40. {<<"1.0">>, 1.0, <<"1">>},
  41. {<<"0.75">>, 0.75},
  42. {<<"2.0123456789">>, 2.0123456789, <<"2.0123456789000000455">>},
  43. {<<"2.4234324E24">>, 2.4234324E24, <<"2.4234323999999998107e+24">>},
  44. {<<"-3.1416">>, -3.1416, <<"-3.1415999999999999481">>},
  45. {<<"1E4">>, 10000.0, <<"10000">>},
  46. {<<"1.0E+01">>, 10.0, <<"10">>},
  47. {<<"1e1">>, 10.0, <<"10">>},
  48. {<<"3.0E2">>, 300.0, <<"300">>},
  49. {<<"0E3">>, 0.0, <<"0">>},
  50. {<<"1.5E3">>, 1500.0, <<"1500">>},
  51. {<<"2.5E-1">>, 0.25, <<"0.25">>},
  52. {<<"-0.325E+2">>, -32.5, <<"-32.5">>}
  53. ].
  54. errors() ->
  55. [
  56. <<"02">>,
  57. <<"-01">>,
  58. <<"+12">>,
  59. <<"-">>,
  60. <<"1.">>,
  61. <<".1">>,
  62. <<"1.-1">>,
  63. <<"1E">>,
  64. <<"1-E2">>,
  65. <<"2E +3">>,
  66. <<"1EA">>
  67. ].