void test_validPath(FILE* out, struct Map* map) { int p2[] = { 0, 0, 0, 1, 0, 2, 1, 2, 2, 3 }; int p3[] = { 1, 2, 1, 1, 2, 3, 1, 1, 2, 3, 2, 1 }; int p4[] = { 1, 2, 1, 2, 1, 2, 3, 4, 1, 1, 2, 2, 3, 2, 1, 0 }; fprintf(out, "esting validPath function...\n"); testPaths(out, map, 2, 5, p2); testPaths(out, map, 3, 4, p3); testPaths(out, map, 4, 4, p4); }
void ChatWindowStyle_Test::allTests() { testStyle = new ChatWindowStyle(QString(SRCDIR)+QString("/TestStyle")); // change user data dir to avoid messing with user's .kde dir setenv( "KDEHOME", QFile::encodeName( QDir::homePath() + "/.kopete-unittest" ), true ); testPaths(); testHtml(); testVariants(); testAction(); }
void testDuplicates() { QwtSplineLocal spline( QwtSplineLocal::Cardinal ); spline.setParametrization( QwtSplineParametrization::ParameterChordal ); QPolygonF points; points += QPointF( 1, 6 ); points += QPointF( 2, 7 ); points += QPointF( 3, 5); points += QPointF( 2, 4 ); points += QPointF( 0, 3 ); // inserting duplicates QPolygonF points1; for ( int i = 0; i < points.size(); i++ ) { points1 += points[i]; points1 += points[i]; } testPaths( "Duplicates", spline, points, points1 ); spline.setBoundaryType( QwtSpline::ClosedPolygon ); testPaths( "Duplicates", spline, points, points1 ); QPolygonF points2 = points; points2.append( points[0] ); testPaths( "First point also at End", spline, points, points2 ); QPolygonF points3 = points; points3.prepend( points.first() ); testPaths( "First point twice", spline, points, points3 ); QPolygonF points4 = points; points4.append( points.last() ); testPaths( "Last point twice", spline, points, points4 ); }
// ***************************************************************************** // Main int main(int argc, char* const argv[]) { testPaths(); return 0; }
int main() { char const *good[] = { ".", "/", "Foo", "/Foo", ".bar", "/Foo/Bar.baz", "/Foo/Bar.baz:argle:bargle", "/_Foo/_Bar._baz", "/_Foo/_Bar._baz:_argle:_bargle", "Foo/Bar", "Foo.bar", "Foo.bar:baz", "Foo/Bar.bar", "Foo/Bar.bar:baz", "/Some/Kinda/Long/Path/Just/To/Make/Sure", "Some/Kinda/Long/Path/Just/To/Make/Sure.property", "Some/Kinda/Long/Path/Just/To/Make/Sure.property:bar:baz", "../Some/Kinda/Long/Path/Just/To/Make/Sure", "../../Some/Kinda/Long/Path/Just/To/Make/Sure.property", "../../Some/Kinda/Long/Path/Just/To/Make/Sure.property:bar:baz", "/Foo/Bar.baz[targ].boom", "/Foo/Bar.baz:argle[targ].boom:bargle", "Foo.bar[targ].boom", "Foo.bar:argle[targ].boom:bargle", ".bar[targ].boom", ".bar:argle[targ].boom:bargle", "Foo.bar[targ.attr].boom", "Foo.bar:argle[targ.attr:baz].boom:bargle", "../../.radius", "../../.radius:bar:baz", "../..", "foo{a=x}", "/foo{a=x}", "../foo{a=x}", "foo{a=x}.prop", "foo{a=x}.prop:bar:baz", "foo{a=1}", "foo{ a = x }", "foo{a=x}{b=y}", "foo {a=x} {b=y} ", "foo { a = x} { b = y } ", "foo{a=x}{b=y}.prop", "foo{a=x}{b=y}.prop:bar:baz", "foo{ a = x }{b=y}", "foo{a=x}{ b = y }", "foo{ a = x }{ b = y }", "foo{a=x}{b=y}{c=z}", "foo{a=x}{b=y}{c=z}.prop", "foo{a=x}{b=y}{c=z}.prop:bar:baz", "foo{a=x}bar", "/foo{a=x}bar", "../foo{a=x}bar", "foo{a=x}bar.prop", "foo{a=x}bar.prop:bar:baz", "foo{a=x}bar{b=y}", "foo{a=x}bar{b=y}.prop", "foo{a=x}bar{b=y}.prop:bar:baz", "foo{a=x}{b=y}bar{c=z}{d=w}", "foo{a=x}bar{b=y}blah{c=z}", "foo{a=x}bar{b=y}blah{c=z}.prop", "foo{a=x}bar{b=y}blah{c=z}.prop:bar:baz", "foo{a=x}bar/blah", "foo{a=x}bar/blah.prop", "foo{a=x}bar/blah.prop:bar:baz", "foo{a=x}bar/blah{c=z}", "foo{a=x}bar/blah{c=z}.prop", "foo{a=x}bar/blah{c=z}.prop:bar:baz", "foo{a=x}bar/blah/baz{c=z}", "foo{a=x}bar/blah{c=z}baz/Burma/Shave", "foo{a=x}bar/blah{c=z}baz/Burma.Shave", "foo{a=x}bar/blah{c=z}baz/Burma.Shave:argle:bargle", "foo{a=.x}", "foo{a=1}", "foo{a=|}", "foo{a=-}", "foo{a=_}", "foo{a=.1}", "foo{a=.|}", "foo{a=.-}", "foo{a=._}", "foo{a=|-_|-_}", "foo{a=.|-_|-_}", "foo.expression", "foo.expression.expression", "foo.expression.mapper[/A.b]", "foo.mapper", "foo.mapper.expression", "foo.mapper.mapper[/A.b]", NULL }; char const *bad[] = { "DD/DDD.&ddf$", "DD[]/DDD", "DD[]/DDD.bar", "foo.prop/bar", "/foo.prop/bar.blah", "/foo.prop/bar.blah", "/foo//bar", "/foo/.bar", "/foo..bar", "/foo.bar.baz", "/.foo", "/Foo.:bar", "/Foo.bar:", "/Foo.:bar:", "/Foo.:bar:baz", "/Foo.bar:baz:", "/Foo.:bar:baz:", "/Foo.bar::baz", "/Foo.bar:0", "</foo.bar", "</Foo/Bar/>", "/Foo:Bar", "/Foo/Bar/", "/Foo.bar[targ]/Bar", "/Foo.bar[targ].foo.foo", "/Foo.bar[targ].foo[targ].foo", "../../", ".rel[targ][targ].attr", ".attr[1, 2, 3].attr", "/TestScene/sphere0.fakepoints[&1 &2 &3]", "/ Foo", "/ Foo", // <- tab " Foo", " Foo", // <- tab "/foo.b ar", "/foo. bar", "Foo.bar[targ].attr[//..]", "foo{}", "foo{,}", "foo{a=x,}", "foo{a=x}{}", "foo{1=x}", "foo{,a=x}", "foo{}{a=x}", "foo{,a=x,}", "foo{}{a=x}{}", "foo{a=x}/bar", "foo{a=x}.prop/bar", "foo{a=x}.prop{b=y}", "foo{a=x.}", "foo{a=.x.}", "foo{a=:}", "foo{a=x:}", "Foo.attr.mapper[/Bar].arg:baz", NULL }; testPaths(good, 0); printf("Testing bad paths: errors expected\n"); testPaths(bad, 1); printf("Done expecting errors\n"); printf("Test PASSED\n"); return 0; }