/test/lib/string/test_fixed.e
http://github.com/tybor/Liberty · Specman e · 44 lines · 35 code · 8 blank · 1 comment · 1 complexity · 2ac41499b7203bfefeb398820616c99e MD5 · raw file
- class TEST_FIXED
- -- Stress fixed strings obtained from C, to discover possible memory leaks or double freeing of memory.
- insert
- MEMORY
- EXCEPTIONS
- EIFFELTEST_TOOLS
- create {}
- make
- feature {}
- make
- local
- mem_usage: INTEGER
- do
- mem_usage := allocated_bytes
- n.times(agent
- do
- n.times(agent
- do
- create foo.from_external(foo_ptr)
- end)
- full_collect
- end)
- debug
- print("Memory usage for " + (n * n).out + " allocations: " + (allocated_bytes - mem_usage).out + " bytes.%N")
- end
- assert(foo.is_equal("my-const-string"))
- end
- n: INTEGER_32 16
- foo: FIXED_STRING
- foo_ptr: POINTER
- external "C inline"
- alias "[
- "my-const-string"
- ]"
- end
- end -- class TEST_FIXED