Skip to content

Commit

Permalink
start fixing some tests, most of which appear 'broken' because of pro…
Browse files Browse the repository at this point in the history
…blems in kakapo. t/sanity.t now passes and should be mre resilient. duplicate some subs from UnitTest::Assertions, which placates most common tests (though assert_throws still barfs, for some reason I can't figure out). Non-common tests generally fail because use(UnitTest::Assertions) does nothing
  • Loading branch information
Whiteknight committed Aug 12, 2010
1 parent 444238a commit 8262a30
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 13 deletions.
2 changes: 1 addition & 1 deletion t/harness
Expand Up @@ -2,7 +2,6 @@

INIT {
pir::load_bytecode('library/kakapo_full.pbc');
Nqp::compile_file('t/testlib/matrixtest.nqp');
}

MAIN();
Expand All @@ -13,6 +12,7 @@ MAIN();
# verbose mode

sub MAIN () {
Nqp::compile_file('t/testlib/matrixtest.nqp');
my $total_passed := 0;
my $total_failed := 0;
my $total_files := 0;
Expand Down
7 changes: 1 addition & 6 deletions t/sanity.t
Expand Up @@ -2,11 +2,6 @@

class Test::Sanity is UnitTest::Testcase;

INIT {
use('UnitTest::Testcase');
use('UnitTest::Assertions');
}

MAIN();
sub MAIN() {
my $proto := Opcode::get_root_global(pir::get_namespace__P().get_name);
Expand All @@ -15,6 +10,6 @@ sub MAIN() {

method test_load_linalg_group() {
my $pla := pir::loadlib__ps("./dynext/linalg_group");
assert_not_instance_of($pla, "Undef", "Cannot load PLA library, linalg_group");
UnitTest::Assertions::assert_not_instance_of($pla, "Undef", "Cannot load PLA library, linalg_group");
}

30 changes: 24 additions & 6 deletions t/testlib/matrixtest.nqp
@@ -1,12 +1,30 @@
# Copyright (C) 2010, Andrew Whitworth. See accompanying LICENSE file, or
# http://www.opensource.org/licenses/artistic-license-2.0.php for license.

INIT {
use('UnitTest::Testcase');
use('UnitTest::Assertions');
}

class Pla::Matrix::Testcase is UnitTest::Testcase {

INIT {
use('UnitTest::Testcase');
use('UnitTest::Assertions');
}

# Temporary stuff util the use() statements above start working properly
our sub assert_equal($a, $b, $c) {
UnitTest::Assertions::assert_equal($a, $b, $c);
}

our sub assert_throws($a, $b, &c) {
UnitTest::Assertions::assert_throws($a, $b, &c);
}

our sub assert_throws_nothing($a, $b) {
UnitTest::Assertions::assert_throws_nothing($a, $b);
}

our sub assert_instance_of($a, $b, $c) {
UnitTest::Assertions::assert_instance_of($a, $b, $c);
}

method default_loader() {
Pla::Matrix::Loader.new;
}
Expand Down Expand Up @@ -657,7 +675,7 @@ method order_tests(@tests) {
}

for @tests -> $name {
my $name_lc := $name.downcase.substr(0, $len);
my $name_lc := pir::downcase__SS($name).substr(0, $len);

if %partition.contains( $name_lc ) {
%partition{$name_lc}.push: $name;
Expand Down

0 comments on commit 8262a30

Please sign in to comment.