EOL
);
define('MARKUP_POSTFIX', <<
This test fails only intermittently.
The failure is caused by a problem in Boost code. The Boost developers are aware of
the problem and plan to fix it.
The failure is caused by a compiler bug.
The failure is caused by a compiler bug, which has been reported to the compiler
supplier (or is already known to them).
The failure is caused by a standard library bug.
EOL
);
define('MARKUP_LIB_ACCUMULATORS', <<
This failure is caused by a timeout when compiling the test. It
passes when the timeout value is increased.
EOL
);
define('MARKUP_LIB_ALGORITHM', <<
These failures are caused by a lack of support/configuration for Boost.Tr1
EOL
);
define('MARKUP_LIB_DETAIL', <<
This indicates that forward declarations could probably be used
for these compilers but currently aren't. All these compilers use
STLport, which is compatible with forward declarations in some
circumstances, but not in others. I haven't looked into how to
determine this, so I've just set container_fwd to never forward
declare for STLport.
GCC's libstdc++ has a versioned namespace feature which breaks
container forwarding. I don't know how to detect it so I'm just
always disabling it, which means that a lot of setups which
means that it's disabled for a lot of setups where it could
work - which is what these failures represent.
Failing because these tests are run with warnings as errors,
and the standard library is causing warnings.
STLport debug mode seems to be broken here.
Some old versions of GCC's libstdc++ don't work on clang with
_GLIBCXX_DEBUG defined.
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2011-May/015178.html
EOL
);
class UpdateExplicitFailuresTest extends \Tester\TestCase {
function testAlmostSortedInsert() {
Assert::same(array('hello'), UpdateExplicitFailures::almostSortedInsert(array(), 'hello'));
Assert::same(array('hello'), UpdateExplicitFailures::almostSortedInsert(array('hello'), 'hello'));
Assert::same(array('hello', 'world'), UpdateExplicitFailures::almostSortedInsert(array('world'), 'hello'));
Assert::same(array('hello', 'world'), UpdateExplicitFailures::almostSortedInsert(array('hello', 'world'), 'hello'));
Assert::same(array('A', 'B', 'D'), UpdateExplicitFailures::almostSortedInsert(array('B', 'D'), 'A'));
Assert::same(array('B', 'C', 'D'), UpdateExplicitFailures::almostSortedInsert(array('B', 'D'), 'C'));
Assert::same(array('B', 'D', 'E'), UpdateExplicitFailures::almostSortedInsert(array('B', 'D'), 'E'));
Assert::same(array('A', 'D', 'B'), UpdateExplicitFailures::almostSortedInsert(array('D', 'B'), 'A'));
Assert::same(array('D', 'B', 'C'), UpdateExplicitFailures::almostSortedInsert(array('D', 'B'), 'C'));
Assert::same(array('D', 'B', 'E'), UpdateExplicitFailures::almostSortedInsert(array('D', 'B'), 'E'));
Assert::same(array('A', 'B', 'F', 'D', 'G'), UpdateExplicitFailures::almostSortedInsert(array('B', 'F', 'D', 'G'), 'A'));
Assert::same(array('B', 'C', 'F', 'D', 'H'), UpdateExplicitFailures::almostSortedInsert(array('B', 'F', 'D', 'H'), 'C'));
Assert::same(array('B', 'F', 'D', 'E', 'H'), UpdateExplicitFailures::almostSortedInsert(array('B', 'F', 'D', 'H'), 'E'));
Assert::same(array('B', 'F', 'D', 'G', 'H'), UpdateExplicitFailures::almostSortedInsert(array('B', 'F', 'D', 'H'), 'G'));
Assert::same(array('B', 'F', 'D', 'H', 'I'), UpdateExplicitFailures::almostSortedInsert(array('B', 'F', 'D', 'H'), 'I'));
}
function testNoChangeExplicitFailures() {
$xml = MARKUP_PREFIX.
MARKUP_LIB_ALGORITHM.
MARKUP_LIB_ACCUMULATORS.
MARKUP_LIB_DETAIL.
MARKUP_POSTFIX;
$update = new UpdateExplicitFailures($xml);
Assert::same($xml, $update->getUpdatedXml());
$update = new UpdateExplicitFailures($xml);
$update->addLibraries($xml);
Assert::same($xml, $update->getUpdatedXml());
$update = new UpdateExplicitFailures($xml);
$update->addLibraries(
"\n".
MARKUP_LIB_DETAIL.
MARKUP_LIB_ACCUMULATORS.
"\n");
Assert::same($xml, $update->getUpdatedXml());
}
function testNewLibExplicitFailures() {
$update = new UpdateExplicitFailures(MARKUP_PREFIX.
MARKUP_LIB_ALGORITHM.
MARKUP_LIB_DETAIL.
MARKUP_POSTFIX);
$update->addLibraries("\n".MARKUP_LIB_ACCUMULATORS.'');
Assert::same(MARKUP_PREFIX.
MARKUP_LIB_ACCUMULATORS.
MARKUP_LIB_ALGORITHM.
MARKUP_LIB_DETAIL.
MARKUP_POSTFIX, $update->getUpdatedXml());
$update = new UpdateExplicitFailures(MARKUP_PREFIX.
MARKUP_LIB_ALGORITHM.
MARKUP_LIB_ACCUMULATORS.
MARKUP_LIB_DETAIL.
MARKUP_POSTFIX);
$update->addLibraries("");
Assert::same(MARKUP_PREFIX.
MARKUP_LIB_ALGORITHM.
MARKUP_LIB_ACCUMULATORS.
MARKUP_LIB_DETAIL.
"\n\n".
MARKUP_POSTFIX, $update->getUpdatedXml());
}
function testUpdateLibExplicitFailures() {
$new_detail = "";
$new_lib = "";
$update = new UpdateExplicitFailures(MARKUP_PREFIX.
MARKUP_LIB_ALGORITHM.
MARKUP_LIB_DETAIL.
MARKUP_LIB_ACCUMULATORS.
MARKUP_POSTFIX);
$update->addLibraries("{$new_detail}");
Assert::same(MARKUP_PREFIX.
MARKUP_LIB_ALGORITHM.
"{$new_detail}\n\n".
MARKUP_LIB_ACCUMULATORS.
MARKUP_POSTFIX, $update->getUpdatedXml());
}
function testMultitpleUpdatesExplicitFailures() {
$new_detail = "";
$new_lib = "";
$update = new UpdateExplicitFailures(MARKUP_PREFIX.
MARKUP_LIB_ALGORITHM.
MARKUP_LIB_DETAIL.
MARKUP_LIB_ACCUMULATORS.
MARKUP_POSTFIX);
$update->addLibraries("{$new_detail}{$new_lib}");
Assert::same(MARKUP_PREFIX.
MARKUP_LIB_ALGORITHM.
"{$new_detail}\n\n".
MARKUP_LIB_ACCUMULATORS.
"{$new_lib}\n\n".
MARKUP_POSTFIX, $update->getUpdatedXml());
$update = new UpdateExplicitFailures(MARKUP_PREFIX.
MARKUP_LIB_ALGORITHM.
MARKUP_LIB_DETAIL.
MARKUP_LIB_ACCUMULATORS.
MARKUP_POSTFIX);
$update->addLibraries($new_detail);
$update->addLibraries("{$new_lib}");
$update->addLibraries(MARKUP_PREFIX.MARKUP_LIB_ACCUMULATORS.MARKUP_POSTFIX);
Assert::same(MARKUP_PREFIX.
MARKUP_LIB_ALGORITHM.
"{$new_detail}\n\n".
MARKUP_LIB_ACCUMULATORS.
"{$new_lib}\n\n".
MARKUP_POSTFIX, $update->getUpdatedXml());
}
/*
I moved lint into the update function, as that has the super project,
so can't test it here for now.
function testLintFailures() {
$xml = MARKUP_PREFIX.
MARKUP_LIB_ALGORITHM.
MARKUP_LIB_ACCUMULATORS.
MARKUP_LIB_DETAIL.
MARKUP_POSTFIX;
Assert::exception(function () {
$update = new UpdateExplicitFailures(MARKUP_PREFIX);
}, 'RuntimeException');
$update = new UpdateExplicitFailures(MARKUP_PREFIX.MARKUP_LIB_DETAIL.MARKUP_POSTFIX);
Assert::exception(function () use ($update) {
$update->addLibraries(MARKUP_PREFIX.''.MARKUP_POSTFIX);
}, 'RuntimeException');
}
*/
function testLibraryMarkupErrors() {
$xml = MARKUP_PREFIX.
MARKUP_LIB_ALGORITHM.
MARKUP_LIB_ACCUMULATORS.
MARKUP_LIB_DETAIL.
MARKUP_POSTFIX;
$update = new UpdateExplicitFailures($xml);
// This is a bug, which could be fixed by improving the regular expression
// or actually using an XML parser, but I don't think it will happen
// for real, just want to make sure the problem is caught.
Assert::exception(function() use($update) {
$update->addLibraries("");
}, 'RuntimeException', '~^Library parse error:~');
Assert::exception(function() use($update) {
$update->addLibraries("");
}, 'RuntimeException', 'Missing library name');
Assert::exception(function() use($update) {
$update->addLibraries("");
}, 'RuntimeException', 'Missing library name');
}
}
$test = new UpdateExplicitFailuresTest();
$test->run();