/test/lib/storage/collection/test_native_array1.e

http://github.com/tybor/Liberty · Specman e · 68 lines · 41 code · 5 blank · 22 comment · 1 complexity · bb8772f54e97eb2668ca81df1e1a9430 MD5 · raw file

  1. -- This file is part of SmartEiffel The GNU Eiffel Compiler Tools and Libraries.
  2. -- See the Copyright notice at the end of this file.
  3. --
  4. class TEST_NATIVE_ARRAY1
  5. create {}
  6. make
  7. feature {ANY}
  8. make
  9. local
  10. a, b: NATIVE_ARRAY[CHARACTER]
  11. do
  12. a := a.calloc(2)
  13. a.put('a', 0)
  14. a.put('b', 1)
  15. assert(a.item(0) = 'a')
  16. assert(a.item(1) = 'b')
  17. a := a.realloc(2, 1024)
  18. assert(a.item(0) = 'a')
  19. assert(a.item(1) = 'b')
  20. b := b.calloc(2)
  21. assert(b.item(0) = '%/0/')
  22. assert(b.item(1) = '%U')
  23. b.put('a', 0)
  24. b.put('b', 1)
  25. assert(b.item(0) = 'a')
  26. assert(b.item(1) = 'b')
  27. b := b.realloc(2, 1024)
  28. assert(b.item(0) = 'a')
  29. assert(b.item(1) = 'b')
  30. assert(a.fast_memcmp(b, 2))
  31. assert(a.memcmp(b, 2))
  32. end
  33. assert (b: BOOLEAN)
  34. do
  35. cpt := cpt + 1
  36. if not b then
  37. std_output.put_string("TEST_NATIVE_ARRAY1: ERROR Test # ")
  38. std_output.put_integer(cpt)
  39. std_output.put_string("%N")
  40. else
  41. -- std_output.put_string("Yes%N");
  42. end
  43. end
  44. cpt: INTEGER
  45. end -- class TEST_NATIVE_ARRAY1
  46. --
  47. -- ------------------------------------------------------------------------------------------------------------------------------
  48. -- Copyright notice below. Please read.
  49. --
  50. -- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License,
  51. -- as published by the Free Software Foundation; either version 2, or (at your option) any later version.
  52. -- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty
  53. -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have
  54. -- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free
  55. -- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
  56. --
  57. -- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P. - University of Nancy 1 - FRANCE
  58. -- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
  59. --
  60. -- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
  61. --
  62. -- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
  63. -- ------------------------------------------------------------------------------------------------------------------------------