From 89381bf8930fa7108ca8caac62cdda243b02d3ad Mon Sep 17 00:00:00 2001 From: Whiteknight Date: Sat, 21 Aug 2010 13:57:04 -0400 Subject: [PATCH] remove the weird test prefixes (METHOD, etc) from some tests. We don't need those now since the tests are broken down into files and I'm not using the fancy loader --- t/methods/complexmatrix2d/conjugate.t | 24 +++++++++ t/testlib/matrixtestbase.nqp | 2 - .../methods/convert_to_complex_matrix.nqp | 2 +- .../methods/convert_to_number_matrix.nqp | 2 +- t/testlib/methods/convert_to_pmc_matrix.nqp | 2 +- t/testlib/methods/fill.nqp | 4 +- t/testlib/methods/gemm.nqp | 14 ++--- t/testlib/methods/get_block.nqp | 38 +++++++++---- t/testlib/methods/initialize_from_args.nqp | 6 +-- t/testlib/methods/initialize_from_array.nqp | 6 +-- t/testlib/methods/item_at.nqp | 54 +++++++++++++++---- .../methods/iterate_function_external.nqp | 8 +-- .../methods/iterate_function_inplace.nqp | 8 +-- t/testlib/methods/mem_transpose.nqp | 4 +- t/testlib/methods/resize.nqp | 6 +-- t/testlib/methods/row_combine.nqp | 14 ++--- t/testlib/methods/row_scale.nqp | 8 +-- t/testlib/methods/row_swap.nqp | 12 ++--- t/testlib/methods/set_block.nqp | 18 ++++--- t/testlib/methods/transpose.nqp | 4 +- 20 files changed, 154 insertions(+), 82 deletions(-) create mode 100644 t/methods/complexmatrix2d/conjugate.t diff --git a/t/methods/complexmatrix2d/conjugate.t b/t/methods/complexmatrix2d/conjugate.t new file mode 100644 index 0000000..0b6d25c --- /dev/null +++ b/t/methods/complexmatrix2d/conjugate.t @@ -0,0 +1,24 @@ +my $tests := Test::ComplexMatrix2D::Conjugate.new(); +$tests.suite.run; + +class Test::ComplexMatrix2D::Conjugate is Pla::MatrixTestBase { + INIT { + use('UnitTest::Testcase'); + use('UnitTest::Assertions'); + } + + has $!factory; + method factory() { + unless pir::defined__IP($!factory) { + $!factory := Pla::MatrixFactory::ComplexMatrix2D.new(); + } + return $!factory; + } + + method test_METHOD_conjugate() { + my $m := self.factory.matrix2x2("1+1i", "2+2i", "3+3i", "4+4i"); + my $n := self.factory.matrix2x2("1-1i", "2-2i", "3-3i", "4-4i"); + $m.conjugate(); + assert_equal($m, $n, "conjugate does not work"); + } +} diff --git a/t/testlib/matrixtestbase.nqp b/t/testlib/matrixtestbase.nqp index b60ab48..601b5ae 100644 --- a/t/testlib/matrixtestbase.nqp +++ b/t/testlib/matrixtestbase.nqp @@ -16,8 +16,6 @@ class Pla::MatrixTestBase is UnitTest::Testcase { self.RequireOverride("factory"); } - method default_loader() { Pla::Matrix::Loader.new; } - method RequireOverride($m) { Exception::MethodNotFound.new( :message("Must subclass " ~ $m ~ " in your test class") diff --git a/t/testlib/methods/convert_to_complex_matrix.nqp b/t/testlib/methods/convert_to_complex_matrix.nqp index 1cce796..523c5c1 100644 --- a/t/testlib/methods/convert_to_complex_matrix.nqp +++ b/t/testlib/methods/convert_to_complex_matrix.nqp @@ -5,7 +5,7 @@ class Pla::Methods::ConvertToComplexMatrix is Pla::MatrixTestBase { use('UnitTest::Assertions'); } - method test_METHOD_convert_to_complex_matrix() { + method test_convert_to_complex_matrix() { my $A := self.factory.defaultmatrix2x2(); my $B := $A.convert_to_complex_matrix(); assert_equal(pir::typeof__SP($B), "ComplexMatrix2D", "cannot convert"); diff --git a/t/testlib/methods/convert_to_number_matrix.nqp b/t/testlib/methods/convert_to_number_matrix.nqp index 7265ed2..db5ab6a 100644 --- a/t/testlib/methods/convert_to_number_matrix.nqp +++ b/t/testlib/methods/convert_to_number_matrix.nqp @@ -5,7 +5,7 @@ class Pla::Methods::ConvertToNumberMatrix is Pla::MatrixTestBase { use('UnitTest::Assertions'); } - method test_METHOD_convert_to_number_matrix() { + method test_convert_to_number_matrix() { my $A := self.factory.defaultmatrix2x2(); my $B := $A.convert_to_number_matrix(); assert_equal(pir::typeof__SP($B), "NumMatrix2D", "cannot convert"); diff --git a/t/testlib/methods/convert_to_pmc_matrix.nqp b/t/testlib/methods/convert_to_pmc_matrix.nqp index f191a90..bf62041 100644 --- a/t/testlib/methods/convert_to_pmc_matrix.nqp +++ b/t/testlib/methods/convert_to_pmc_matrix.nqp @@ -5,7 +5,7 @@ class Pla::Methods::ConvertToPmcMatrix is Pla::MatrixTestBase { use('UnitTest::Assertions'); } - method test_METHOD_convert_to_pmc_matrix() { + method test_convert_to_pmc_matrix() { my $A := self.factory.defaultmatrix2x2(); my $B := $A.convert_to_pmc_matrix(); assert_equal(pir::typeof__SP($B), "PMCMatrix2D", "cannot convert"); diff --git a/t/testlib/methods/fill.nqp b/t/testlib/methods/fill.nqp index 37ba218..19fd841 100644 --- a/t/testlib/methods/fill.nqp +++ b/t/testlib/methods/fill.nqp @@ -6,7 +6,7 @@ class Pla::Methods::Fill is Pla::MatrixTestBase { } # Test that we can fill a matrix - method test_METHOD_fill() { + method test_fill() { my $m := self.factory.defaultmatrix2x2(); my $n := self.factory.matrix2x2( self.factory.fancyvalue(0), @@ -19,7 +19,7 @@ class Pla::Methods::Fill is Pla::MatrixTestBase { } # test that the fill method can be used to resize the matrix - method test_METHOD_fill_RESIZE() { + method test_fill_with_resizing() { my $m := self.factory.defaultmatrix2x2(); my $n := self.factory.matrix(); $n.fill(self.factory.defaultvalue(), 2, 2); diff --git a/t/testlib/methods/gemm.nqp b/t/testlib/methods/gemm.nqp index 2d9f5d0..06140d3 100644 --- a/t/testlib/methods/gemm.nqp +++ b/t/testlib/methods/gemm.nqp @@ -10,7 +10,7 @@ class Pla::Methods::Gemm is Pla::MatrixTestBase { method test_METHOD_gemm_aAB() { self.RequireOverride("test_METHOD_gemm_aAB"); } method test_METHOD_gemm_aABbC() { self.RequireOverride("test_METHOD_gemm_aABbC"); } - method test_METHOD_gemm_BADTYPE_A() { + method test_bad_type_A() { assert_throws(Exception::OutOfBounds, "A is bad type", { my $A := "foobar"; @@ -20,7 +20,7 @@ class Pla::Methods::Gemm is Pla::MatrixTestBase { }); } - method test_METHOD_gemm_BADTYPE_B() { + method test_bad_type_B() { assert_throws(Exception::OutOfBounds, "B is bad type", { my $A := self.factory.defaultmatrix3x3(); @@ -30,7 +30,7 @@ class Pla::Methods::Gemm is Pla::MatrixTestBase { }); } - method test_METHOD_gemm_BADTYPE_C() { + method test_bad_type_C() { assert_throws(Exception::OutOfBounds, "C is bad type", { my $A := self.factory.defaultmatrix3x3(); @@ -40,7 +40,7 @@ class Pla::Methods::Gemm is Pla::MatrixTestBase { }); } - method test_METHOD_gemm_BADSIZE_A() { + method test_bad_size_A() { assert_throws(Exception::OutOfBounds, "A has incorrect size", { my $A := self.factory.defaultmatrix2x2(); @@ -50,7 +50,7 @@ class Pla::Methods::Gemm is Pla::MatrixTestBase { }); } - method test_METHOD_gemm_BADSIZE_B() { + method test_bad_size_B() { assert_throws(Exception::OutOfBounds, "B has incorrect size", { my $A := self.factory.defaultmatrix3x3(); @@ -60,7 +60,7 @@ class Pla::Methods::Gemm is Pla::MatrixTestBase { }); } - method test_METHOD_gemm_BADSIZE_C() { + method test_bad_size_C() { assert_throws(Exception::OutOfBounds, "C has incorrect size", { my $A := self.factory.defaultmatrix3x3(); @@ -82,4 +82,4 @@ class Pla::Methods::Gemm is Pla::MatrixTestBase { method test_METHOD_gemm_AUTOCONVERT_B_PMCMatrix2D() { todo("Write this!"); } method test_METHOD_gemm_AUTOCONVERT_C_PMCMatrix2D() { todo("Write this!"); } -} \ No newline at end of file +} diff --git a/t/testlib/methods/get_block.nqp b/t/testlib/methods/get_block.nqp index 7857e3e..890dbd3 100644 --- a/t/testlib/methods/get_block.nqp +++ b/t/testlib/methods/get_block.nqp @@ -6,7 +6,7 @@ class Pla::Methods::GetBlock is Pla::MatrixTestBase { } # Test that we can get a block from the matrix - method test_METHOD_get_block() { + method test_get_block() { my $m := self.factory.fancymatrix2x2(); my $n := $m.get_block(0, 0, 1, 1); self.AssertSize($n, 1, 1); @@ -25,7 +25,7 @@ class Pla::Methods::GetBlock is Pla::MatrixTestBase { # TODO: Other tests for this method with other argument combinations and # boundary checks. - method test_METHOD_get_block_1() { + method test_get_block_1() { my $m := self.factory.matrix3x3(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0); @@ -35,7 +35,7 @@ class Pla::Methods::GetBlock is Pla::MatrixTestBase { assert_equal($n, $o, "cannot get block"); } - method test_METHOD_get_block_2() { + method test_get_block_2() { my $m := self.factory.matrix3x3(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0); @@ -46,40 +46,56 @@ class Pla::Methods::GetBlock is Pla::MatrixTestBase { } # Test that we can use get_block to make a copy - method test_METHOD_get_block_COPY() { + method test_get_block_as_a_copy_routine() { my $m := self.factory.fancymatrix2x2(); my $n := $m.get_block(0, 0, 2, 2); assert_equal($m, $n, "We cannot use get_block to create a faithful copy"); } # Test that get_block(0,0,0,0) returns a zero-size matrix - method test_METHOD_get_block_ZEROSIZE() { + method test_request_zero_size_gets_zero_size() { my $m := self.factory.defaultmatrix2x2(); my $n := $m.get_block(0, 0, 0, 0); self.AssertSize($n, 0, 0); } # Test that get_block(-1,-1,0,0) throws the proper exception - method test_METHOD_get_block_NEGINDICES() { + method test_negative_index_A() { assert_throws(Exception::OutOfBounds, "Can get_block with negative indices", { my $m := self.factory.defaultmatrix2x2(); - my $n := $m.get_block(-1, -1, 1, 1); + my $n := $m.get_block(-1, 0, 1, 1); + }); + } + + method test_negative_index_B() { + assert_throws(Exception::OutOfBounds, "Can get_block with negative indices", + { + my $m := self.factory.defaultmatrix2x2(); + my $n := $m.get_block(0, -1, 1, 1); }); } # Test that get_block(0,0,-1,-1) throws the proper exception - method test_METHOD_get_block_NEGSIZES() { + method test_negative_size_A() { + assert_throws(Exception::OutOfBounds, "Can get_block with negative indices", + { + my $m := self.factory.defaultmatrix2x2(); + my $n := $m.get_block(1, 1, -1, 1); + }); + } + + method test_negative_size_A() { assert_throws(Exception::OutOfBounds, "Can get_block with negative indices", { my $m := self.factory.defaultmatrix2x2(); - my $n := $m.get_block(1, 1, -1, -1); + my $n := $m.get_block(1, 1, 1, -1); }); } # Test the behavior of get_block when we request a block crossing or outside # the boundaries of the matrix - method test_METHOD_get_block_BOUNDS_CROSSED() { + method test_requested_block_crosses_matrix_boundaries() { assert_throws(Exception::OutOfBounds, "Can get_block crossing boundaries of matrix", { my $m := self.factory.defaultmatrix2x2(); @@ -89,7 +105,7 @@ class Pla::Methods::GetBlock is Pla::MatrixTestBase { # Test that calling get_block with coordinates outside the bounds of the # matrix throws an exception - method test_METHOD_get_block_OUTSIDE() { + method test_requested_block_outside_matrix() { assert_throws(Exception::OutOfBounds, "Can get_block outside boundaries of matrix", { my $m := self.factory.defaultmatrix2x2(); diff --git a/t/testlib/methods/initialize_from_args.nqp b/t/testlib/methods/initialize_from_args.nqp index 79cebde..090e497 100644 --- a/t/testlib/methods/initialize_from_args.nqp +++ b/t/testlib/methods/initialize_from_args.nqp @@ -6,7 +6,7 @@ class Pla::Methods::InitializeFromArgs is Pla::MatrixTestBase { } # Test that we can initialize from a list of arguments - method test_METHOD_initialize_from_args() { + method test_initialize_from_args() { my $m := self.factory.matrix2x2(self.factory.fancyvalue(0), self.factory.fancyvalue(1), self.factory.fancyvalue(2), self.factory.fancyvalue(3)); my $n := self.factory.matrix(); @@ -16,7 +16,7 @@ class Pla::Methods::InitializeFromArgs is Pla::MatrixTestBase { } # Test that we can initialize from an arg list with zero padding - method test_METHOD_initialize_from_args_ZEROPAD() { + method test_null_pad_extra_spaces() { my $m := self.factory.matrix3x3(self.factory.fancyvalue(0), self.factory.fancyvalue(1), self.factory.fancyvalue(2), self.factory.fancyvalue(3), self.factory.nullvalue, self.factory.nullvalue, self.factory.nullvalue, self.factory.nullvalue, self.factory.nullvalue); @@ -28,7 +28,7 @@ class Pla::Methods::InitializeFromArgs is Pla::MatrixTestBase { # Test that we can initialize from an arg list, ignoring values that we # don't need - method test_METHOD_initialize_from_args_UNDERSIZE() { + method test_ignore_extra_values() { my $m := self.factory.matrix(); $m{Key.new(0,0)} := self.factory.fancyvalue(0); my $n := self.factory.matrix(); diff --git a/t/testlib/methods/initialize_from_array.nqp b/t/testlib/methods/initialize_from_array.nqp index 0ebe997..71cdcfc 100644 --- a/t/testlib/methods/initialize_from_array.nqp +++ b/t/testlib/methods/initialize_from_array.nqp @@ -6,7 +6,7 @@ class Pla::Methods::InitializeFromArray is Pla::MatrixTestBase { } # Test that we can initialize from an array - method test_METHOD_initialize_from_array() { + method test_initialize_from_array() { my $a := [self.factory.fancyvalue(0), self.factory.fancyvalue(1), self.factory.fancyvalue(2), self.factory.fancyvalue(3)]; my $m := self.factory.matrix2x2(self.factory.fancyvalue(0), self.factory.fancyvalue(1), @@ -17,7 +17,7 @@ class Pla::Methods::InitializeFromArray is Pla::MatrixTestBase { } # Test that we can initialize from array, including zero padding - method test_METHOD_initialize_from_array_ZEROPAD() { + method test_null_pad_extra_items() { my $a := [self.factory.fancyvalue(0), self.factory.fancyvalue(1), self.factory.fancyvalue(2), self.factory.fancyvalue(3)]; my $m := self.factory.matrix3x3(self.factory.fancyvalue(0), self.factory.fancyvalue(1), self.factory.fancyvalue(2), @@ -30,7 +30,7 @@ class Pla::Methods::InitializeFromArray is Pla::MatrixTestBase { # Test that when we initialize from an array, that we only use as many # values as required - method test_METHOD_initialize_from_array_UNDERSIZE() { + method test_ignore_extra_values() { my $a := [self.factory.fancyvalue(0), self.factory.fancyvalue(1), self.factory.fancyvalue(2), self.factory.fancyvalue(3)]; my $m := self.factory.matrix(); diff --git a/t/testlib/methods/item_at.nqp b/t/testlib/methods/item_at.nqp index c62eeaa..a94fafc 100644 --- a/t/testlib/methods/item_at.nqp +++ b/t/testlib/methods/item_at.nqp @@ -5,7 +5,7 @@ class Pla::Methods::ItemAt is Pla::MatrixTestBase { use('UnitTest::Assertions'); } - method test_METHOD_item_at() { + method test_item_at() { my $m := self.factory.fancymatrix2x2(); assert_equal(self.factory.fancyvalue(0), $m.item_at(0, 0), "cannot get item 0,0"); assert_equal(self.factory.fancyvalue(1), $m.item_at(0, 1), "cannot get item 0,1"); @@ -13,23 +13,39 @@ class Pla::Methods::ItemAt is Pla::MatrixTestBase { assert_equal(self.factory.fancyvalue(3), $m.item_at(1, 1), "cannot get item 1,1"); } - method test_METHOD_item_at_BOUNDS() { + method test_out_of_bounds_index_A() { my $m := self.factory.defaultmatrix2x2(); assert_throws(Exception::OutOfBounds, "can item_at out of bounds", { - $m.item_at(4, 4); + $m.item_at(1, 4); }); } - method test_METHOD_item_at_NEGINDICES() { + method test_out_of_bounds_index_B() { my $m := self.factory.defaultmatrix2x2(); assert_throws(Exception::OutOfBounds, "can item_at out of bounds", { - $m.item_at(-1, -1); + $m.item_at(4, 1); }); } - method test_METHOD_item_at_EMPTY() { + method test_negative_index_A() { + my $m := self.factory.defaultmatrix2x2(); + assert_throws(Exception::OutOfBounds, "can item_at out of bounds", + { + $m.item_at(-1, 0); + }); + } + + method test_negative_index_B() { + my $m := self.factory.defaultmatrix2x2(); + assert_throws(Exception::OutOfBounds, "can item_at out of bounds", + { + $m.item_at(0, -1); + }); + } + + method test_item_from_empty_matrix() { my $m := self.factory.matrix(); assert_throws(Exception::OutOfBounds, "can item_at out of bounds", { @@ -37,7 +53,7 @@ class Pla::Methods::ItemAt is Pla::MatrixTestBase { }); } - method test_METHOD_item_at_VALUE() { + method test_set_optional_third_parameter() { my $m := self.factory.fancymatrix2x2(); my $n := self.factory.fancymatrix2x2(); $n{Key.new(1, 1)} := self.factory.fancyvalue(0); @@ -45,15 +61,31 @@ class Pla::Methods::ItemAt is Pla::MatrixTestBase { assert_equal($m, $n, "item_at(VALUE) does not work like keyed access"); } - method test_METHOD_item_at_VALUE_BOUNDS() { + method test_set_out_of_bounds_index_A() { my $m := self.factory.defaultmatrix2x2(); assert_throws(Exception::OutOfBounds, "can item_at out of bounds", { - $m.item_at(4, 4, self.factory.fancyvalue(0)); + $m.item_at(4, 1, self.factory.fancyvalue(0)); + }); + } + + method test_set_out_of_bounds_index_B() { + my $m := self.factory.defaultmatrix2x2(); + assert_throws(Exception::OutOfBounds, "can item_at out of bounds", + { + $m.item_at(1, 4, self.factory.fancyvalue(0)); + }); + } + + method test_set_at_negative_index_A() { + my $m := self.factory.defaultmatrix2x2(); + assert_throws(Exception::OutOfBounds, "can item_at out of bounds", + { + $m.item_at(-1, -1, self.factory.fancyvalue(0)); }); } - method test_METHOD_item_at_VALUE_NEGINDICES() { + method test_set_at_negative_index_B() { my $m := self.factory.defaultmatrix2x2(); assert_throws(Exception::OutOfBounds, "can item_at out of bounds", { @@ -61,7 +93,7 @@ class Pla::Methods::ItemAt is Pla::MatrixTestBase { }); } - method test_METHOD_item_at_VALUE_EMPTY() { + method test_set_empty_matrix_does_not_grow() { my $m := self.factory.matrix(); assert_throws(Exception::OutOfBounds, "can item_at out of bounds", { diff --git a/t/testlib/methods/iterate_function_external.nqp b/t/testlib/methods/iterate_function_external.nqp index 0f9b064..aecac1c 100644 --- a/t/testlib/methods/iterate_function_external.nqp +++ b/t/testlib/methods/iterate_function_external.nqp @@ -6,7 +6,7 @@ class Pla::Methods::IterateFunctionExternal is Pla::MatrixTestBase { } # Test that we can iterate_function_external, and create a new matrix - method test_METHOD_iterate_function_external() { + method test_iterate_function_external() { my $m := self.factory.fancymatrix2x2(); my $sub := sub ($matrix, $value, $x, $y) { return $value; @@ -16,7 +16,7 @@ class Pla::Methods::IterateFunctionExternal is Pla::MatrixTestBase { } # Test that iterate_function_external passes the correct coordinates - method test_METHOD_iterate_function_external_COORDS() { + method test_get_correct_coordinates() { my $m := self.factory.matrix2x2(self.factory.nullvalue, self.factory.nullvalue, self.factory.nullvalue, self.factory.nullvalue); my $n := self.factory.matrix2x2(self.factory.fancyvalue(0), self.factory.fancyvalue(1), @@ -29,7 +29,7 @@ class Pla::Methods::IterateFunctionExternal is Pla::MatrixTestBase { } # Test that iterate_function_external passes the correct args - method test_METHOD_iterate_function_external_ARGS() { + method test_passes_optional_args() { my $m := self.factory.matrix2x2(self.factory.nullvalue, self.factory.nullvalue, self.factory.nullvalue, self.factory.nullvalue); my $n := self.factory.matrix2x2(self.factory.fancyvalue(3), self.factory.fancyvalue(3), @@ -43,7 +43,7 @@ class Pla::Methods::IterateFunctionExternal is Pla::MatrixTestBase { # Test that iterate_function_external respects the transpose state of the # matrix - method test_METHOD_iterate_function_external_TRANSPOSE() { + method test_handles_lazy_transpose() { my $m := self.factory.fancymatrix2x2(); $m.transpose(); my $n := self.factory.matrix2x2(self.factory.fancyvalue(0) * 2, self.factory.fancyvalue(2) * 2, diff --git a/t/testlib/methods/iterate_function_inplace.nqp b/t/testlib/methods/iterate_function_inplace.nqp index 0c28c22..08d3955 100644 --- a/t/testlib/methods/iterate_function_inplace.nqp +++ b/t/testlib/methods/iterate_function_inplace.nqp @@ -6,7 +6,7 @@ class Pla::Methods::IterateFunctionInplace is Pla::MatrixTestBase { } # Test that we can iterate a function in-place - method test_METHOD_iterate_function_inplace() { + method test_iterate_function_inplace() { my $m := self.factory.defaultmatrix2x2(); my $n := self.factory.matrix(); $n{Key.new(0,0)} := self.factory.fancyvalue(0); @@ -25,7 +25,7 @@ class Pla::Methods::IterateFunctionInplace is Pla::MatrixTestBase { # test that iterate_function_inplace calls the callback with the proper # coordinates - method test_METHOD_iterate_function_inplace_COORDS() { + method test_pass_correct_coordinates() { my $m := self.factory.fancymatrix2x2(); my $count := 0; my $x_ords := [0, 0, 1, 1]; @@ -41,7 +41,7 @@ class Pla::Methods::IterateFunctionInplace is Pla::MatrixTestBase { } # Test that iterate_function_inplace passes the correct args - method test_METHOD_iterate_function_inplace_ARGS() { + method test_pass_optional_arguments() { my $m := self.factory.fancymatrix2x2(); my $count := 0; my $first := 5; @@ -58,7 +58,7 @@ class Pla::Methods::IterateFunctionInplace is Pla::MatrixTestBase { # Test that iterate_function_external respects the transpose state of the # matrix - method test_METHOD_iterate_function_inplace_TRANSPOSE() { + method test_handles_lazy_transpose() { my $m := self.factory.fancymatrix2x2(); $m.transpose(); my $n := self.factory.matrix2x2(self.factory.fancyvalue(0) * 2, self.factory.fancyvalue(2) * 2, diff --git a/t/testlib/methods/mem_transpose.nqp b/t/testlib/methods/mem_transpose.nqp index ef0170b..1355271 100644 --- a/t/testlib/methods/mem_transpose.nqp +++ b/t/testlib/methods/mem_transpose.nqp @@ -6,7 +6,7 @@ class Pla::Methods::MemTranspose is Pla::MatrixTestBase { } # Test mem transposing square matrices - method test_METHOD_mem_transpose() { + method test_mem_transpose() { my $m := self.factory.matrix2x2( self.factory.fancyvalue(0), self.factory.fancyvalue(1), @@ -24,7 +24,7 @@ class Pla::Methods::MemTranspose is Pla::MatrixTestBase { } # Test mem transposing non-square matrices - method test_METHOD_mem_transpose_DIMCHANGE() { + method test_non_square_matrix() { my $m := self.factory.matrix(); $m{Key.new(0,0)} := self.factory.fancyvalue(0); $m{Key.new(0,1)} := self.factory.fancyvalue(1); diff --git a/t/testlib/methods/resize.nqp b/t/testlib/methods/resize.nqp index ec6130e..ba04a12 100644 --- a/t/testlib/methods/resize.nqp +++ b/t/testlib/methods/resize.nqp @@ -6,14 +6,14 @@ class Pla::Methods::Resize is Pla::MatrixTestBase { } # Test the resize method - method test_METHOD_resize() { + method test_resize() { my $m := self.factory.matrix(); $m.resize(3,3); self.AssertSize($m, 3, 3); } # Test that we cannot shrink a matrix using the resize method - method test_METHOD_resize_SHRINK() { + method test_resize_does_not_shrink() { my $m := self.factory.matrix(); $m.resize(3,3); $m.resize(1,1); @@ -21,7 +21,7 @@ class Pla::Methods::Resize is Pla::MatrixTestBase { } # Test that resize method with negative indices does nothing - method test_METHOD_resize_NEGATIVEINDICES() { + method test_negative_indices() { my $m := self.factory.matrix(); $m.resize(-1, -1); self.AssertSize($m, 0, 0); diff --git a/t/testlib/methods/row_combine.nqp b/t/testlib/methods/row_combine.nqp index b3b4acc..d21c762 100644 --- a/t/testlib/methods/row_combine.nqp +++ b/t/testlib/methods/row_combine.nqp @@ -5,7 +5,7 @@ class Pla::Methods::RowCombine is Pla::MatrixTestBase { use('UnitTest::Assertions'); } - method test_METHOD_row_combine() { + method test_row_combine() { my $A := self.factory.fancymatrix2x2(); my $val1; my $val2; @@ -30,7 +30,7 @@ class Pla::Methods::RowCombine is Pla::MatrixTestBase { assert_equal($A, $B, "cannot row_combine"); } - method test_METHOD_row_combine_GAIN() { + method test_non_unity_gain() { my $A := self.factory.fancymatrix2x2(); my $B := self.factory.matrix2x2(self.factory.fancyvalue(0) + self.factory.fancyvalue(2) * self.factory.fancyvalue(0), self.factory.fancyvalue(1) + self.factory.fancyvalue(3) * self.factory.fancyvalue(0), @@ -39,7 +39,7 @@ class Pla::Methods::RowCombine is Pla::MatrixTestBase { assert_equal($A, $B, "cannot row_combine"); } - method test_METHOD_row_combine_NEGINDICES_A() { + method test_negative_index_A() { assert_throws(Exception::OutOfBounds, "Index A is out of bounds", { my $A := self.factory.defaultmatrix3x3(); @@ -47,7 +47,7 @@ class Pla::Methods::RowCombine is Pla::MatrixTestBase { }); } - method test_METHOD_row_combine_BOUNDS_A() { + method test_index_A_out_of_bounds() { assert_throws(Exception::OutOfBounds, "Index A is out of bounds", { my $A := self.factory.defaultmatrix3x3(); @@ -55,7 +55,7 @@ class Pla::Methods::RowCombine is Pla::MatrixTestBase { }); } - method test_METHOD_row_combine_NEGINDICES_B() { + method test_negative_index_B() { assert_throws(Exception::OutOfBounds, "Index B is out of bounds", { my $A := self.factory.defaultmatrix3x3(); @@ -63,11 +63,11 @@ class Pla::Methods::RowCombine is Pla::MatrixTestBase { }); } - method test_METHOD_row_combine_BOUNDS_B() { + method test_index_B_out_of_bounds() { assert_throws(Exception::OutOfBounds, "Index B is out of bounds", { my $A := self.factory.defaultmatrix3x3(); $A.row_combine(1, 7, 1); }); } -} \ No newline at end of file +} diff --git a/t/testlib/methods/row_scale.nqp b/t/testlib/methods/row_scale.nqp index 00ee2b0..47c5d4a 100644 --- a/t/testlib/methods/row_scale.nqp +++ b/t/testlib/methods/row_scale.nqp @@ -5,7 +5,7 @@ class Pla::Methods::RowScale is Pla::MatrixTestBase { use('UnitTest::Assertions'); } - method test_METHOD_row_scale() { + method test_row_scale() { my $A := self.factory.matrix(); $A.initialize_from_args(3, 3, self.factory.fancyvalue(0), self.factory.fancyvalue(0), self.factory.fancyvalue(0), @@ -23,7 +23,7 @@ class Pla::Methods::RowScale is Pla::MatrixTestBase { assert_equal($A, $B, "cannot scale rows"); } - method test_METHOD_row_scale_NEGINDICES() { + method test_negative_row_index() { assert_throws(Exception::OutOfBounds, "index is negative", { my $A := self.factory.defaultmatrix3x3(); @@ -31,11 +31,11 @@ class Pla::Methods::RowScale is Pla::MatrixTestBase { }); } - method test_METHOD_row_scale_BOUNDS() { + method test_row_index_out_of_bounds() { assert_throws(Exception::OutOfBounds, "index is negative", { my $A := self.factory.defaultmatrix3x3(); $A.row_scale(7, 1); }); } -} \ No newline at end of file +} diff --git a/t/testlib/methods/row_swap.nqp b/t/testlib/methods/row_swap.nqp index aee1cad..102b88d 100644 --- a/t/testlib/methods/row_swap.nqp +++ b/t/testlib/methods/row_swap.nqp @@ -5,7 +5,7 @@ class Pla::Methods::RowSwap is Pla::MatrixTestBase { use('UnitTest::Assertions'); } - method test_METHOD_row_swap() { + method test_row_swap() { my $A := self.factory.matrix(); $A.initialize_from_args(3, 3, self.factory.fancyvalue(0), self.factory.fancyvalue(0), self.factory.fancyvalue(0), @@ -22,7 +22,7 @@ class Pla::Methods::RowSwap is Pla::MatrixTestBase { assert_equal($A, $B, "cannot row_swap"); } - method test_METHOD_row_swap_NEGINDICES_A() { + method test_negative_index_A() { assert_throws(Exception::OutOfBounds, "Index A is out of bounds", { my $A := self.factory.defaultmatrix3x3(); @@ -30,7 +30,7 @@ class Pla::Methods::RowSwap is Pla::MatrixTestBase { }); } - method test_METHOD_row_swap_BOUNDS_A() { + method test_index_A_out_of_bounds() { assert_throws(Exception::OutOfBounds, "Index A is out of bounds", { my $A := self.factory.defaultmatrix3x3(); @@ -38,7 +38,7 @@ class Pla::Methods::RowSwap is Pla::MatrixTestBase { }); } - method test_METHOD_row_swap_NEGINDICES_B() { + method test_negative_index_B() { assert_throws(Exception::OutOfBounds, "Index B is out of bounds", { my $A := self.factory.defaultmatrix3x3(); @@ -46,11 +46,11 @@ class Pla::Methods::RowSwap is Pla::MatrixTestBase { }); } - method test_METHOD_row_swap_BOUNDS_B() { + method test_index_B_out_of_bounds() { assert_throws(Exception::OutOfBounds, "Index B is out of bounds", { my $A := self.factory.defaultmatrix3x3(); $A.row_swap(1, 7); }); } -} \ No newline at end of file +} diff --git a/t/testlib/methods/set_block.nqp b/t/testlib/methods/set_block.nqp index 13e93b8..a41515f 100644 --- a/t/testlib/methods/set_block.nqp +++ b/t/testlib/methods/set_block.nqp @@ -6,7 +6,7 @@ class Pla::Methods::SetBlock is Pla::MatrixTestBase { } # Test set_block - method test_METHOD_set_block() { + method test_set_block() { my $m := self.factory.fancymatrix2x2(); my $n := self.factory.matrix(); $n{Key.new(2,2)} := self.factory.nullvalue; @@ -30,7 +30,7 @@ class Pla::Methods::SetBlock is Pla::MatrixTestBase { } # Test set_block with a block of zero size - method test_METHOD_set_block_ZEROSIZE() { + method test_zero_size_block() { my $m := self.factory.fancymatrix2x2(); my $n := pir::clone__PP($m); my $o := self.factory.matrix(); @@ -43,7 +43,7 @@ class Pla::Methods::SetBlock is Pla::MatrixTestBase { # go to the specified coordinates, but there is no first element so there # is no item at the specified coordinates. Think of the block as a # zero-sized point to the upper-left of the coordinate. - method test_METHOD_set_block_ZERO_RESIZE() { + method test_zero_size_block_outside_bounds() { my $m := self.factory.defaultmatrix2x2(); my $o := self.factory.matrix(); $m.set_block(3, 3, $o); @@ -61,7 +61,7 @@ class Pla::Methods::SetBlock is Pla::MatrixTestBase { # Test that set_block can resize the matrix if the specified coordinates # are outside the matrix - method test_METHOD_set_block_RESIZE_COORDS() { + method test_resize_with_block_outside_bounds() { my $m := self.factory.defaultmatrix2x2(); my $o := self.factory.matrix(); $o{Key.new(0, 0)} := self.factory.fancyvalue(2); @@ -83,7 +83,7 @@ class Pla::Methods::SetBlock is Pla::MatrixTestBase { # Test that set_block can resize the matrix if the specified coordinates # are outside the matrix - method test_METHOD_set_block_RESIZE_BLKSIZE() { + method test_block_larger_than_matrix() { my $m := self.factory.defaultmatrix2x2(); my $o := self.factory.defaultmatrix2x2(); my $n := self.factory.matrix3x3(self.factory.defaultvalue, self.factory.defaultvalue, self.factory.nullvalue, @@ -95,7 +95,7 @@ class Pla::Methods::SetBlock is Pla::MatrixTestBase { } # Test that set_block with negative indices throws an exception - method test_METHOD_set_block_NEGINDICES() { + method test_negative_indicies() { assert_throws(Exception::OutOfBounds, "Can set_block with negative indices", { my $m := self.factory.defaultmatrix2x2(); @@ -106,7 +106,7 @@ class Pla::Methods::SetBlock is Pla::MatrixTestBase { # Test that we can set_block on an empty matrix and cause it to resize # appropriately - method test_METHOD_set_block_OVERFLOW() { + method test_set_block_on_empty_matrix() { my $m := self.factory.fancymatrix2x2(); my $n := self.factory.matrix(); $n.set_block(1, 1, $m); @@ -129,7 +129,9 @@ class Pla::Methods::SetBlock is Pla::MatrixTestBase { } # Test that calling set_block with a scalar throws an exception - method test_METHOD_set_block_SCALAR() { + # TODO: Is this behavior that we want to set? If so, we can treat the + # scalar as a 1x1 matrix? + method test_set_scalar_as_block() { my $m := self.factory.defaultmatrix2x2(); my $n := ""; assert_throws(Exception::OutOfBounds, "Can set_block a scalar", { diff --git a/t/testlib/methods/transpose.nqp b/t/testlib/methods/transpose.nqp index 87d2dac..0aeddf4 100644 --- a/t/testlib/methods/transpose.nqp +++ b/t/testlib/methods/transpose.nqp @@ -6,7 +6,7 @@ class Pla::Methods::Transpose is Pla::MatrixTestBase { } # Test transposing square matrices - method test_METHOD_transpose() { + method test_transpose() { my $m := self.factory.matrix2x2( self.factory.fancyvalue(0), self.factory.fancyvalue(1), @@ -24,7 +24,7 @@ class Pla::Methods::Transpose is Pla::MatrixTestBase { } # Test transposing non-square matrices - method test_METHOD_transpose_DIMCHANGE() { + method test_nonsquare_matrix_transpose() { my $m := self.factory.matrix(); $m{Key.new(0,0)} := self.factory.fancyvalue(0); $m{Key.new(0,1)} := self.factory.fancyvalue(1);