From a13f126f6f7527d531e073d43b1421ccfd2bdb9b Mon Sep 17 00:00:00 2001 From: Whiteknight Date: Mon, 15 Mar 2010 12:58:13 -0400 Subject: [PATCH] override fill() tests for charmatrix2d. It behaves subtly different than other matrix types because of it's focus on string arrays. --- t/Testcase.nqp | 2 -- t/pmc/charmatrix2d.t | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/t/Testcase.nqp b/t/Testcase.nqp index 27a8584..6429c14 100644 --- a/t/Testcase.nqp +++ b/t/Testcase.nqp @@ -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"); } diff --git a/t/pmc/charmatrix2d.t b/t/pmc/charmatrix2d.t index d007a88..6476d68 100644 --- a/t/pmc/charmatrix2d.t +++ b/t/pmc/charmatrix2d.t @@ -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(); @@ -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"); +}