Skip to content

Commit

Permalink
add low level thread-safe accessor tests #13
Browse files Browse the repository at this point in the history
  • Loading branch information
dwarring committed May 29, 2022
1 parent 09f0da9 commit cfe9a77
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion t/00threads.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use Test;
plan 1;
plan 2;
use LibXML::Config;
use LibXML::Element;
use LibXML::Raw;
Expand All @@ -22,6 +22,40 @@ unless LibXML::Config.have-threads {
exit 0;
}

subtest 'low-level', {
{
my $passing = True;
for (^MAX_LOOP) -> $i {
my @ok = blat(
-> $j {
xml6_gbl_set_tag_expansion(($i + $j + 1) %% 2);
# do a little work
my LibXML::Element $e .= new('elem' ~ $i ~ '_' ~ $j);
xml6_gbl_get_tag_expansion() == ($i + $j + 1) %% 2;
}
);
$passing = False unless @ok.all.so;
}
ok $passing, 'tag expansion native';
}

{
my $passing = True;
for (^MAX_LOOP) -> $i {
my @ok = blat(
-> $j {
LibXML::Raw.TagExpansion = ($i + $j + 1) %% 2;
# do a little work
my LibXML::Element $e .= new('elem' ~ $i ~ '_' ~ $j);
LibXML::Raw.TagExpansion == ($i + $j + 1) %% 2;
}
);
$passing = False unless @ok.all.so;
}
ok $passing, 'tag expansion proxy';
}
}

subtest 'configs', {
my @configs = (^MAX_THREADS).map: {LibXML::Config.new};

Expand Down

0 comments on commit cfe9a77

Please sign in to comment.