Skip to content

Commit

Permalink
override fill() tests for charmatrix2d. It behaves subtly different t…
Browse files Browse the repository at this point in the history
…han other matrix types because of it's focus on string arrays.
  • Loading branch information
Whiteknight committed Mar 15, 2010
1 parent e630f9d commit a13f126
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
2 changes: 0 additions & 2 deletions t/Testcase.nqp
Expand Up @@ -186,8 +186,6 @@ class Pla::Testcase is UnitTest::Testcase {
self.fancyvalue(),
self.fancyvalue()
);
pir::say($m);
pir::say($n);
$m.fill(self.fancyvalue());
assert_equal($n, $m, "Cannot fill");
}
Expand Down
32 changes: 32 additions & 0 deletions t/pmc/charmatrix2d.t
Expand Up @@ -27,6 +27,15 @@ sub MAIN() {
method matrix() {
return (Parrot::new("CharMatrix2D"));
}
method defaultvalue() {
return "A";
}
method nullvalue() {
return " ";
}
method fancyvalue() {
return "Z";
}

method test_VTABLE_set_string_keyed_int() {
my $c := self.matrix();
Expand Down Expand Up @@ -94,3 +103,26 @@ method test_VTABLE_set_number_keyed() {
method test_VTABLE_set_pmc_keyed() {
todo("Tests Needed!");
}
method test_METHOD_fill() {
my $m := self.defaultmatrix2x2();
my $n := self.matrix2x2(
self.fancyvalue(),
self.fancyvalue(),
self.fancyvalue(),
self.fancyvalue()
);
$m.fill(90);
assert_equal($n, $m, "Cannot fill");
}
method test_METHOD_fill_RESIZE() {
my $m := self.matrix();
my $n := self.matrix2x2(
self.fancyvalue(),
self.fancyvalue(),
self.fancyvalue(),
self.fancyvalue()
);
$m.fill(90, 2, 2);
assert_equal($n, $m, "Cannot fill");
}

0 comments on commit a13f126

Please sign in to comment.