From 3dfdedd4252d985acc415d412d0e44d4aa9761d2 Mon Sep 17 00:00:00 2001 From: Kodi Arfer Date: Sun, 12 Sep 2010 07:40:33 -0400 Subject: [PATCH] KeyHash.elems should return the sum of the values, not the number of values. --- S02-builtin_data_types/keyhash.t | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/S02-builtin_data_types/keyhash.t b/S02-builtin_data_types/keyhash.t index 6685383663..69eca4426e 100644 --- a/S02-builtin_data_types/keyhash.t +++ b/S02-builtin_data_types/keyhash.t @@ -9,9 +9,10 @@ plan 18; my %h is KeyHash; %h = (a => 1, b => 3, c => -1, d => 7); - is +%h.elems, 4, 'Inititalization worked'; + is +%h.keys, 4, 'Inititalization worked'; + is %h.elems, 10, '.elems'; lives_ok { %h = 0 }, 'can set an item to 0'; - is %h.elems, 3, '... and an item is gone'; + is +%h.keys, 3, '... and an item is gone'; is %h.keys.sort.join(''), 'abc', '... and the right one is gone'; %h++; is %h.keys.sort.join(''), 'ab', '++ on an item with -1 deletes it'; @@ -33,9 +34,10 @@ plan 18; my Int %h is KeyHash; %h = (a => 1, b => 3, c => -1, d => 7); - is +%h.elems, 4, 'Inititalization worked'; + is +%h.keys, 4, 'Inititalization worked'; + is %h.elems, 10, '.elems'; lives_ok { %h = 0 }, 'can set an item to 0'; - is %h.elems, 3, '... and an item is gone'; + is +%h.keys, 3, '... and an item is gone'; is %h.keys.sort.join(''), 'abc', '... and the right one is gone'; %h++; is %h.keys.sort.join(''), 'ab', '++ on an item with -1 deletes it';