Skip to content

Commit

Permalink
KeyHash.elems should return the sum of the values, not the number of …
Browse files Browse the repository at this point in the history
…values.
  • Loading branch information
Kodi Arfer authored and Kodi Arfer committed Sep 12, 2010
1 parent 367d08a commit 3dfdedd
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions S02-builtin_data_types/keyhash.t
Expand Up @@ -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<d> = 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<c>++;
is %h.keys.sort.join(''), 'ab', '++ on an item with -1 deletes it';
Expand All @@ -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<d> = 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<c>++;
is %h.keys.sort.join(''), 'ab', '++ on an item with -1 deletes it';
Expand Down

0 comments on commit 3dfdedd

Please sign in to comment.