From 94e52b52a2db8166039ccf78c3f33c8f28fe3cbb Mon Sep 17 00:00:00 2001 From: Steve Bertrand Date: Fri, 16 Jul 2021 09:42:28 -0700 Subject: [PATCH] Added integer key tests --- t/04-key.t | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/t/04-key.t b/t/04-key.t index 6b7873f..5109128 100644 --- a/t/04-key.t +++ b/t/04-key.t @@ -100,4 +100,28 @@ use Test::More; } } +# integers +{ + my %key_hash = ( + 1 => 1, + 11 => 11, + 10 => 10, + 1000 => 1000, + 65535 => 65535, + ); + + for (keys %key_hash) { + + my $k = tie my $sv, 'IPC::Shareable', {key => $_, create => 1, destroy => 1}; + + my $attr_key = $k->attributes('key'); + is $attr_key, $_, "'$_' as key is the proper attribute ok"; + + my $key = $k->seg->key; + is $key, $key_hash{$_}, "...and key '$_' converted to '$key' ok"; + + $k->clean_up_all; + } +} + done_testing();