From 1d73b52f5ba4184de6acf474f14668001304a10c Mon Sep 17 00:00:00 2001 From: David Barr Date: Mon, 9 Aug 2010 17:34:42 -0500 Subject: Add string-specific memory pool Intern strings so they can be compared by address and stored without wasting space. This library uses the macros in the obj_pool.h and trp.h to create a memory pool for strings and expose an API for handling them. [rr: added API docs] [jn: with some API simplifications, new documentation and tests] Signed-off-by: David Barr Signed-off-by: Ramkumar Ramachandra Signed-off-by: Jonathan Nieder Signed-off-by: Junio C Hamano --- t/t0080-vcs-svn.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 't') diff --git a/t/t0080-vcs-svn.sh b/t/t0080-vcs-svn.sh index ce02c58e3e..99a314b080 100755 --- a/t/t0080-vcs-svn.sh +++ b/t/t0080-vcs-svn.sh @@ -76,6 +76,22 @@ test_expect_success 'obj pool: high-water mark' ' test_cmp expected actual ' +test_expect_success 'string pool' ' + echo a does not equal b >expected.differ && + echo a equals a >expected.match && + echo equals equals equals >expected.matchmore && + + test-string-pool "a,--b" >actual.differ && + test-string-pool "a,a" >actual.match && + test-string-pool "equals-equals" >actual.matchmore && + test_must_fail test-string-pool a,a,a && + test_must_fail test-string-pool a && + + test_cmp expected.differ actual.differ && + test_cmp expected.match actual.match && + test_cmp expected.matchmore actual.matchmore +' + test_expect_success 'treap sort' ' cat <<-\EOF >unsorted && 68 -- cgit v1.2.3