Device-Solenodrive
view release on metacpan or search on metacpan
t/03-internal.t view on Meta::CPAN
my $unescaped = $soleno->_unescape($escaped);
is $unescaped, $data, "Unescaping yields original string";
$unescaped = $soleno->_unescape("\x00\x01\x02\x03\x05\x04\x05\x05\x06");
is $unescaped, "\x00\x01\x02\x03\x04\x05\x06", "Standalone unescape test";
# Verify the CRC funcions
my $input = "\x00\x04\x01\x05\xFF\x84\x00\xFC\x00\x00";
my $crc = $soleno->_crc16($input);
is $crc, 0xCBC1, "CRC calculates according to the expected implementation";
# Verify invalid write_parameters cause the expected fails
throws_ok { $soleno->_write_packet( "BABE", "BE" ) } qr/Address should be 8/,
"Check address length";
throws_ok { $soleno->_write_packet( "BABEFACE", "B" ) }
qr/Command should be 2 /, "Check command length";
lives_ok { $soleno->_write_packet( "BABEFACE", "FF" ) }
"No Mr. Powers, I expect you to die!";
done_testing();
( run in 0.595 second using v1.01-cache-2.11-cpan-df04353d9ac )