Advertisement
ed195cm

Untitled

Nov 22nd, 2022
1,239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Erlang 2.24 KB | Source Code | 0 0
  1. -module(lab02_tests).
  2.  
  3. -include_lib("eunit/include/eunit.hrl").
  4.  
  5. mix_1_test() ->
  6.         ?assertEqual({"iced tea + lemonade", 25}, lab02:mixBeverages({"iced tea", 23}, {"lemonade", 2})).
  7.  
  8. isOlder_1_test() ->
  9.         false = lab02:isOlder({10, 3, 2016}, {10, 3, 2016}).
  10.  
  11. isOlder_2_test() ->
  12.         true = lab02:isOlder({10, 3, 2016}, {11, 3, 2016}).
  13.  
  14. isOlder_3_test() ->
  15.         true = lab02:isOlder({10, 1, 2016}, {10, 2, 2016}).
  16.  
  17. isOlder_4_test() ->
  18.         false = lab02:isOlder({10, 3, 2016}, {11, 2, 2016}).
  19.  
  20. isOlder_5_test() ->
  21.         true = lab02:isOlder({10, 12, 2015}, {10, 12, 2016}).
  22.  
  23. isOlder_6_test() ->
  24.         true = lab02:isOlder({11, 12, 2015}, {10, 12, 2016}).
  25.  
  26. isOlder_7_test() ->
  27.         true = lab02:isOlder({12, 11, 2016}, {12, 10, 2017}).
  28.  
  29. isOlder_8_test() ->
  30.         true = lab02:isOlder({12, 10, 2016}, {11, 3, 2017}).
  31.  
  32. moveDecimal_1_test() ->
  33.         [] = lab02:moveDecimal([], 1).
  34.  
  35. moveDecimal_2_test() ->
  36.     [10.0, 20.0, 30.0] = lab02:moveDecimal([1,2,3], 1).
  37.    
  38. moveDecimal_3_test() ->
  39.     [0.10, 0.20] = lab02:moveDecimal([1,2], -1).
  40.  
  41. removeNegatives_1_test() ->
  42.     ?assertEqual([0,1,2], lab02:removeNegatives([-1,0,1,2,-3])).
  43.  
  44. removeNegatives2_1_test() ->
  45.     [0,1,2] = lab02:removeNegatives2([-1,0,1,2,-3]).
  46.    
  47. calculatePay_1_test() ->
  48.     {john, 1000} = lab02:calculatePay({john,100,10}).
  49.    
  50. generate_1_test() ->
  51.     [] = lab02:generate(100,1,2).
  52.    
  53. generate_2_test() ->
  54.     [3,5,7] = lab02:generate(3,8,2).
  55.    
  56.  
  57. getnth_1_test() ->
  58.     {error, no_such_element} = lab02:getnth( [ ], 2).
  59.    
  60. getnth_2_test() ->
  61.     {error, no_such_element} = lab02:getnth( ["hello", "there"], 3).
  62. getnth_3_test() ->
  63.     {error, no_such_element} = lab02:getnth( ["hello", "there"], 0).
  64. getnth_4_test() ->
  65.     "there" = lab02:getnth( ["hello", "there"], 2).
  66. getnth_5_test() ->
  67.     "there" = lab02:getnth( ["hello", "there", "where"], 2).
  68. getnth_6_test() ->
  69.     "where" = lab02:getnth( ["hello", "there", "where"], 3).
  70. getnth_7_test() ->
  71.     "where" = lab02:getnth( ["hello", "there", "where", "here"], 3).
  72.  
  73. repeat_1_test() ->
  74.     [2, 2, 2, 2, 3] = lab02:repeat([1, 2, 3], [0, 4, 1]).
  75. repeat_2_test() ->
  76.     [] = lab02:repeat( [], [0, 4, 1]).
  77. repeat_3_test() ->
  78.     [] = lab02:repeat( [1, 2, 3], []).
  79. repeat_4_test() ->
  80.     [4,4] = lab02:repeat( [4,5,6], [2]).
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement