/test/lib/numeric/integer/test_integer_range.e

http://github.com/tybor/Liberty · Specman e · 23 lines · 18 code · 5 blank · 0 comment · 0 complexity · d605497806f7097cbd23598e3a075a41 MD5 · raw file

  1. class TEST_INTEGER_RANGE
  2. insert
  3. EIFFELTEST_TOOLS
  4. create {}
  5. make
  6. feature {}
  7. make
  8. local
  9. sum: INTEGER
  10. do
  11. sum := ({INTEGER 1} |..| {INTEGER 1000}).aggregate(agent add(?,?), 0)
  12. assert(sum = (1000*1001)//2)
  13. end
  14. add (a, b: INTEGER): INTEGER
  15. do
  16. Result := a + b
  17. end
  18. end