-]);
-ok($example, 'example parser');
-my $data = $example->unpackf("\2foo\0!\0.rest");
-is(ref $data, 'HASH', 'output structure');
-is($data->{foos}->[1]->{period}, ord '.', 'sample element');
+);
+my $testdata = "\2foo\0!\0.rest";
+my $testresult = {
+ foos => [
+ {message => 'foo', period => '!'},
+ {message => '', period => '.'},
+ ],
+ trail => 'rest',
+};
+
+my $parser = Parse::Binary::Nested->new(\@example);
+ok($parser, 'new object');
+is_deeply($parser->unpackf($testdata), $testresult, 'object unpackf');
+
+Parse::Binary::Nested->import('unpackf');
+is_deeply(
+ unpackf(\@example, $testdata),
+ $testresult,
+ 'unprepared unpackf'
+);
+
+my @commonargs = ('cxaXv', "\1\2hi\0");
+is_deeply(
+ [ values %{ unpackf(@commonargs) } ],
+ [[ unpack($commonargs[0], $commonargs[1]) ]],
+ 'unpack compatibility'
+);