/src/wrappers/common/test/test_const_string.e

http://github.com/tybor/Liberty · Specman e · 62 lines · 36 code · 11 blank · 15 comment · 0 complexity · 7c1eb2641ee5e64895e91add1c41033b MD5 · raw file

  1. class TEST_CONST_STRING
  2. inherit
  3. EIFFELTEST_TOOLS
  4. create {ANY}
  5. make
  6. feature {ANY}
  7. make
  8. local
  9. cs: CONST_STRING; s: STRING
  10. do
  11. s := "teststring"
  12. create cs.from_external(const_s_ptr)
  13. assert(cs.count = 10)
  14. assert(s.is_equal(cs))
  15. assert(s <= cs)
  16. assert(s >= cs)
  17. assert(cs > "test")
  18. assert(cs >= "test")
  19. assert(cs <= "teststring-long")
  20. assert(cs < "teststring-long")
  21. assert(cs.in_range(create {CONST_STRING}.from_external(short_const_s_ptr), create {CONST_STRING}.from_external(long_const_s_ptr)))
  22. end
  23. feature {} -- externals
  24. const_s_ptr: POINTER
  25. external "C macro"
  26. alias "%"teststring%""
  27. end
  28. short_const_s_ptr: POINTER
  29. external "C macro"
  30. alias "%"test%""
  31. end
  32. long_const_s_ptr: POINTER
  33. external "C macro"
  34. alias "%"teststring-long%""
  35. end
  36. end -- class TEST_CONST_STRING
  37. -- Copyright (C) 2009-2017: , 2013 Paolo Redaelli, 2013 Cyril Adrian
  38. -- This library is free software; you can redistribute it and/or
  39. -- modify it under the terms of the GNU Lesser General Public License
  40. -- as published by the Free Software Foundation; either version 2.1 of
  41. -- the License, or (at your option) any later version.
  42. --
  43. -- This library is distributed in the hope that it will be useful, but
  44. -- WITHOUT ANY WARRANTY; without even the implied warranty of
  45. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  46. -- Lesser General Public License for more details.
  47. --
  48. -- You should have received a copy of the GNU Lesser General Public
  49. -- License along with this library; if not, write to the Free Software
  50. -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  51. -- 02110-1301 USA