Skip to content

Commit

Permalink
Clean up some of the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
drforr committed Jan 7, 2020
1 parent eecfab7 commit cf4f9fe
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 61 deletions.
4 changes: 2 additions & 2 deletions t/01-internals.t
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ my $fh = open FILENAME, :r, :bin;
my $header-info = OLE::Storage_Lite._getHeaderInfo( $fh );
close $fh;

is $header-info.<_SMALL_BLOCK_SIZE>, 64;
is $header-info.<_BIG_BLOCK_SIZE>, 512;
is $header-info.<_SMALL_BLOCK_SIZE>, 2**6;
is $header-info.<_BIG_BLOCK_SIZE>, 2**9;

is $header-info.<_SBD_START>, 2**32-2;
is $header-info.<_ROOT_START>, 25;
Expand Down
52 changes: 25 additions & 27 deletions t/11-parse-ole-with-data.t
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ subtest 'Workbook', {

is $node.No, 1, 'No';
is $node.Type, 2, 'Type';
is $node.Size, 4096, 'Size';
is $node.Size, 2**12, 'Size';
is $node.Name, 'Workbook', 'Name';
is $node.StartBlock, 0, 'StartBlock';
is $node.PrevPps, 2**32 - 1, 'PrevPps';
Expand All @@ -80,19 +80,18 @@ subtest 'SummaryInformation', {

isa-ok $node, OLE::Storage_Lite::PPS::File;

is $node.No, 2, 'No';
is $node.Type, 2, 'Type';
is $node.Size, 4096, 'Size';
is $node.Name,
qq{\x[05]SummaryInformation}, 'Name';
is $node.StartBlock, 8, 'StartBlock';
is $node.PrevPps, 1, 'PrevPps';
is $node.NextPps, 3, 'NextPps';
is $node.DirPps, 2**32 - 1, 'DirPps';
is $node.Data.[31], 242, 'Data';
# is-deeply $node.Time1st, [ Int ], 'Time1st';
# is-deeply $node.Time2nd, [ Int ], 'Time2nd';
is-deeply $node.Child, [ ], 'Time2nd';
is $node.Child.elems, 0, 'Child count';
is $node.No, 2, 'No';
is $node.Type, 2, 'Type';
is $node.Size, 2**12, 'Size';
is $node.Name, qq{\x[05]SummaryInformation}, 'Name';
is $node.StartBlock, 8, 'StartBlock';
is $node.PrevPps, 1, 'PrevPps';
is $node.NextPps, 3, 'NextPps';
is $node.DirPps, 2**32 - 1, 'DirPps';
is $node.Data.[31], 242, 'Data';
# is-deeply $node.Time1st, [ Int ], 'Time1st';
# is-deeply $node.Time2nd, [ Int ], 'Time2nd';

done-testing;
};
Expand All @@ -104,19 +103,18 @@ subtest 'DocumentSummaryInformation', {

isa-ok $node, OLE::Storage_Lite::PPS::File;

is $node.No, 3, 'No';
is $node.Type, 2, 'Type';
is $node.Size, 4096, 'Size';
is $node.Name,
qq{\x[05]DocumentSummaryInformation}, 'Name';
is $node.StartBlock, 16, 'StartBlock';
is $node.PrevPps, 2**32 - 1, 'PrevPps';
is $node.NextPps, 2**32 - 1, 'NextPps';
is $node.DirPps, 2**32 - 1, 'DirPps';
is $node.Data.[31], 213, 'Data';
# is-deeply $node.Time1st, [ Int ], 'Time1st';
# is-deeply $node.Time2nd, [ Int ], 'Time2nd';
is-deeply $node.Child, [ ], 'Child';
is $node.Child.elems, 0, 'Child count';
is $node.No, 3, 'No';
is $node.Type, 2, 'Type';
is $node.Size, 2**12, 'Size';
is $node.Name, qq{\x[05]DocumentSummaryInformation}, 'Name';
is $node.StartBlock, 16, 'StartBlock';
is $node.PrevPps, 2**32 - 1, 'PrevPps';
is $node.NextPps, 2**32 - 1, 'NextPps';
is $node.DirPps, 2**32 - 1, 'DirPps';
is $node.Data.[31], 213, 'Data';
# is-deeply $node.Time1st, [ Int ], 'Time1st';
# is-deeply $node.Time2nd, [ Int ], 'Time2nd';

done-testing;
};
Expand Down
64 changes: 32 additions & 32 deletions t/21-write-small-ole.t
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ subtest 'before writing', {

my $node = $workbook;

isa-ok $node, OLE::Storage_Lite::PPS::File;
isa-ok $node, OLE::Storage_Lite::PPS::File;

is $node.Data[0], 0x41, 'Data 0';
is $node.Data[1], 0x42, 'Data 1';
is $node.Name, "Workbook", 'Name';
is $node.Type, 2, 'Type';
# is-deeply $node.Time1st, [], 'Time1st';
# is-deeply $node.Time2nd, [], 'Time2nd';
is-deeply $node.Child, [], 'Child';
is $node.Child.elems, 0, 'Child count';
is $node.Data[0], 0x41, 'Data 0';
is $node.Data[1], 0x42, 'Data 1';
is $node.Name, "Workbook", 'Name';
is $node.Type, 2, 'Type';
# is-deeply $node.Time1st, [], 'Time1st';
# is-deeply $node.Time2nd, [], 'Time2nd';

done-testing;
};
Expand All @@ -71,12 +71,12 @@ subtest 'before writing', {

isa-ok $node, OLE::Storage_Lite::PPS::File;

is $node.Data.[0], 0x41, 'Data';
is $node.Name, "File_2", 'Name';
is $node.Type, 2, 'Type';
is $node.Child.elems, 0, 'Child count';
is $node.Data.[0], 0x41, 'Data';
is $node.Name, "File_2", 'Name';
is $node.Type, 2, 'Type';
# is-deeply $node.Time1st, [], 'Time1st';
# is-deeply $node.Time2nd, [], 'Time2nd';
is-deeply $node.Child, [], 'Child';

done-testing;
};
Expand All @@ -88,12 +88,12 @@ subtest 'before writing', {

isa-ok $node, OLE::Storage_Lite::PPS::File;

is $node.Data.[0], 0x42, 'Data';
is $node.Name, "File_3", 'Name';
is $node.Type, 2, 'Type';
# is-deeply $node.Time1st, [], 'Time1st';
# is-deeply $node.Time2nd, [], 'Time2nd';
is-deeply $node.Child, [], 'Child';
is $node.Child.elems, 0, 'Child count';
is $node.Data.[0], 0x42, 'Data';
is $node.Name, "File_3", 'Name';
is $node.Type, 2, 'Type';
# is-deeply $node.Time1st, [], 'Time1st';
# is-deeply $node.Time2nd, [], 'Time2nd';

done-testing;
};
Expand All @@ -105,12 +105,12 @@ subtest 'before writing', {

isa-ok $node, OLE::Storage_Lite::PPS::File;

is $node.Data.[0], 0x43, 'Data';
is $node.Name, "File_4", 'Name';
is $node.Type, 2, 'Type';
# is-deeply $node.Time1st, [], 'Time1st';
# is-deeply $node.Time2nd, [], 'Time2nd';
is-deeply $node.Child, [], 'Child';
is $node.Child.elems, 0, 'Child count';
is $node.Data.[0], 0x43, 'Data';
is $node.Name, "File_4", 'Name';
is $node.Type, 2, 'Type';
# is-deeply $node.Time1st, [], 'Time1st';
# is-deeply $node.Time2nd, [], 'Time2nd';

done-testing;
};
Expand All @@ -122,12 +122,12 @@ subtest 'before writing', {

isa-ok $node, OLE::Storage_Lite::PPS::Dir;

is $node.Child.elems, 3, 'Child count';
is $node.Data, Any, 'Data';
is $node.Name, "Dir", 'Name';
is $node.Type, 1, 'Type';
# is-deeply $node.Time1st, [ 0, 0, 0, 1, 0, 0 ], 'Time1st';
# is-deeply $node.Time2nd, [ 0, 0, 0, 1, 0, 0 ], 'Time2nd';
is $node.Child.elems, 3, 'Child count';

done-testing;
};
Expand All @@ -139,12 +139,12 @@ subtest 'before writing', {

isa-ok $node, OLE::Storage_Lite::PPS::Root;

is $node.Child.elems, 2, 'Child count';
is $node.Data, Any, 'Data';
is $node.Name, 'Root Entry', 'Name';
is $node.Type, 5, 'Type';
# is-deeply $node.Time1st, [ 0, 0, 0, 1, 0, 0 ], 'Time1st';
# is-deeply $node.Time2nd, [ 0, 0, 0, 1, 0, 0 ], 'Time2nd';
is $node.Child.elems, 2, 'Child count';

done-testing;
};
Expand All @@ -170,6 +170,7 @@ subtest 'read small-block file', {

isa-ok $node, OLE::Storage_Lite::PPS::Root;

is $node.Child.elems, 2, 'Child count';
is $node.No, 0, 'No';
is $node.Type, 5, 'Type';
is $node.Size, 576, 'Size';
Expand All @@ -181,7 +182,6 @@ subtest 'read small-block file', {
is $node.PrevPps, 2**32 - 1, 'PrevPps';
is $node.NextPps, 2**32 - 1, 'NextPps';
is $node.DirPps, 1, 'DirPps';
is $node.Child.elems, 2, 'Child';

done-testing;
};
Expand All @@ -193,6 +193,7 @@ subtest 'read small-block file', {

isa-ok $node, OLE::Storage_Lite::PPS::File;

is $node.Child.elems, 0, 'Child';
is $node.No, 2, 'No';
is $node.Type, 2, 'Type';
is $node.Size, 6, 'Size';
Expand All @@ -204,7 +205,6 @@ subtest 'read small-block file', {
is $node.PrevPps, 2**32 - 1, 'PrevPps';
is $node.NextPps, 2**32 - 1, 'NextPps';
is $node.DirPps, 2**32 - 1, 'DirPps';
is $node.Child.elems, 0, 'Child';

done-testing;
};
Expand All @@ -216,6 +216,7 @@ subtest 'read small-block file', {

isa-ok $node, OLE::Storage_Lite::PPS::Dir;

is $node.Child.elems, 3, 'Child';
is $node.No, 1, 'No';
is $node.Type, 1, 'Type';
is $node.Size, 0, 'Size';
Expand All @@ -227,7 +228,6 @@ subtest 'read small-block file', {
is $node.PrevPps, 2, 'PrevPps';
is $node.NextPps, 2**32 - 1, 'NextPps';
is $node.DirPps, 3, 'DirPps';
is $node.Child.elems, 3, 'Child';

done-testing;
};
Expand All @@ -239,6 +239,7 @@ subtest 'read small-block file', {

isa-ok $node, OLE::Storage_Lite::PPS::File;

is $node.Child.elems, 0, 'Child';
is $node.No, 4, 'No';
is $node.Type, 2, 'Type';
is $node.Size, 2**12, 'Size';
Expand All @@ -250,7 +251,6 @@ subtest 'read small-block file', {
is $node.PrevPps, 2**32 - 1, 'PrevPps';
is $node.NextPps, 2**32 - 1, 'NextPps';
is $node.DirPps, 2**32 - 1, 'DirPps';
is $node.Child.elems, 0, 'Child';

done-testing;
};
Expand All @@ -262,6 +262,7 @@ subtest 'read small-block file', {

isa-ok $node, OLE::Storage_Lite::PPS::File;

is $node.Child.elems, 0, 'Child';
is $node.No, 3, 'No';
is $node.Type, 2, 'Type';
is $node.Size, 2**8, 'Size';
Expand All @@ -273,7 +274,6 @@ subtest 'read small-block file', {
is $node.PrevPps, 4, 'PrevPps';
is $node.NextPps, 5, 'NextPps';
is $node.DirPps, 2**32 - 1, 'DirPps';
is $node.Child.elems, 0, 'Child';

done-testing;
};
Expand All @@ -285,6 +285,7 @@ subtest 'read small-block file', {

isa-ok $node, OLE::Storage_Lite::PPS::File;

is $node.Child.elems, 0, 'Child';
is $node.No, 5, 'No';
is $node.Type, 2, 'Type';
is $node.Size, 2**8, 'Size';
Expand All @@ -296,7 +297,6 @@ subtest 'read small-block file', {
is $node.PrevPps, 2**32 - 1, 'PrevPps';
is $node.NextPps, 2**32 - 1, 'NextPps';
is $node.DirPps, 2**32 - 1, 'DirPps';
is $node.Child.elems, 0, 'Child';

done-testing;
};
Expand Down

0 comments on commit cf4f9fe

Please sign in to comment.