summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar David Barr <david.barr@cordelta.com>2010-08-09 17:34:42 -0500
committerLibravatar Junio C Hamano <gitster@pobox.com>2010-08-14 19:35:37 -0700
commit1d73b52f5ba4184de6acf474f14668001304a10c (patch)
treeeab339299282709e45101c011ba57b565278a18e /t
parentAdd treap implementation (diff)
downloadtgif-1d73b52f5ba4184de6acf474f14668001304a10c.tar.xz
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 <david.barr@cordelta.com> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t0080-vcs-svn.sh16
1 files changed, 16 insertions, 0 deletions
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