PageRenderTime 50ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/trunk/Examples/test-suite/octave/li_std_set_runme.m

#
MATLAB | 96 lines | 68 code | 28 blank | 0 comment | 18 complexity | fdfed79c931897c095d08c117d599a7c MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. li_std_set
  2. s = set_string()
  3. s.append("a")
  4. s.append("b")
  5. s.append("c")
  6. sum = ""
  7. for i in s:
  8. sum = sum + i
  9. if (sum != "abc")
  10. error
  11. i = s.__iter__()
  12. if i.next() != "a":
  13. error
  14. if i.next() != "b":
  15. error
  16. if i.next() != "c":
  17. error
  18. b = s.begin()
  19. e = s.end()
  20. sum = ""
  21. while (b != e):
  22. sum = sum + b.next()
  23. if sum != "abc":
  24. error
  25. b = s.rbegin()
  26. e = s.rend()
  27. sum = ""
  28. while (b != e):
  29. sum = sum + b.next()
  30. if sum != "cba":
  31. error
  32. si = set_int()
  33. si.append(1)
  34. si.append(2)
  35. si.append(3)
  36. i = si.__iter__()
  37. if i.next() != 1:
  38. error
  39. if i.next() != 2:
  40. error
  41. if i.next() != 3:
  42. error
  43. i = s.begin()
  44. i.next()
  45. s.erase(i)
  46. b = s.begin()
  47. e = s.end()
  48. sum = ""
  49. while (b != e):
  50. sum = sum + b.next()
  51. if sum != "ac":
  52. error
  53. b = s.begin()
  54. e = s.end()
  55. if e - b != 2:
  56. error
  57. m = b + 1
  58. if m.value() != "c":
  59. error
  60. s = pyset()
  61. s.insert((1,2))
  62. s.insert(1)
  63. s.insert("hello")
  64. sum = ()
  65. for i in s:
  66. sum = sum + (i,)
  67. if sum != (1, 'hello', (1, 2)):
  68. error