diff options
author | Paul Fisher <rao@gnu.org> | 1998-10-03 23:47:05 +0000 |
---|---|---|
committer | Paul Fisher <rao@gnu.org> | 1998-10-03 23:47:05 +0000 |
commit | 0fa31f26401139b9de7568f4a2f4b5dcbdaa4047 (patch) | |
tree | e6086f0b967baa864da24daced65966ab9d6e200 /gnu/test | |
parent | 4e04678a2e2f4182054305d6a258f8472977a398 (diff) | |
download | classpath-0fa31f26401139b9de7568f4a2f4b5dcbdaa4047.tar.gz |
Initial commit of the testsuite driving code.
Diffstat (limited to 'gnu/test')
-rw-r--r-- | gnu/test/Fail.java | 42 | ||||
-rw-r--r-- | gnu/test/Pass.java | 42 | ||||
-rw-r--r-- | gnu/test/Result.java | 69 | ||||
-rw-r--r-- | gnu/test/Test.java | 41 | ||||
-rw-r--r-- | gnu/test/Unresolved.java | 42 | ||||
-rw-r--r-- | gnu/test/Unsupported.java | 44 | ||||
-rw-r--r-- | gnu/test/Untested.java | 42 | ||||
-rw-r--r-- | gnu/test/XFail.java | 42 | ||||
-rw-r--r-- | gnu/test/XPass.java | 42 |
9 files changed, 406 insertions, 0 deletions
diff --git a/gnu/test/Fail.java b/gnu/test/Fail.java new file mode 100644 index 000000000..9dd12f239 --- /dev/null +++ b/gnu/test/Fail.java @@ -0,0 +1,42 @@ +/************************************************************************* +/* Fail.java -- Result code returned when test failed but was expected to +/* pass. +/* +/* Copyright (c) 1998 Free Software Foundation, Inc. +/* Written by Paul Fisher (rao@gnu.org) +/* +/* This library is free software; you can redistribute it and/or modify +/* it under the terms of the GNU Library General Public License as published +/* by the Free Software Foundation, either version 2 of the License, or +/* (at your option) any later verion. +/* +/* This library is distributed in the hope that it will be useful, but +/* WITHOUT ANY WARRANTY; without even the implied warranty of +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +/* GNU Library General Public License for more details. +/* +/* You should have received a copy of the GNU Library General Public License +/* along with this library; if not, write to the Free Software Foundation +/* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA +/*************************************************************************/ + +package gnu.test; + +/** + * Test failed but was expected to pass. + */ +public class Fail extends Result +{ + /** + * Constructs a Fail result code with additional information. + */ + public Fail(String msg) { + super("FAIL", msg); + } + /** + * Constructs a Fail result code. + */ + public Fail() { + this(""); + } +} diff --git a/gnu/test/Pass.java b/gnu/test/Pass.java new file mode 100644 index 000000000..866b83b95 --- /dev/null +++ b/gnu/test/Pass.java @@ -0,0 +1,42 @@ +/************************************************************************* +/* Pass.java -- Result code returned when test passed and was excepted to +/* pass. +/* +/* Copyright (c) 1998 Free Software Foundation, Inc. +/* Written by Paul Fisher (rao@gnu.org) +/* +/* This library is free software; you can redistribute it and/or modify +/* it under the terms of the GNU Library General Public License as published +/* by the Free Software Foundation, either version 2 of the License, or +/* (at your option) any later verion. +/* +/* This library is distributed in the hope that it will be useful, but +/* WITHOUT ANY WARRANTY; without even the implied warranty of +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +/* GNU Library General Public License for more details. +/* +/* You should have received a copy of the GNU Library General Public License +/* along with this library; if not, write to the Free Software Foundation +/* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA +/*************************************************************************/ + +package gnu.test; + +/** + * Test passed and was excepted to pass. + */ +public class Pass extends Result +{ + /** + * Constructs a Pass result code with additional information. + */ + public Pass(String msg) { + super("PASS", msg); + } + /** + * Constructs a Pass result code. + */ + public Pass() { + this(""); + } +} diff --git a/gnu/test/Result.java b/gnu/test/Result.java new file mode 100644 index 000000000..6d43e13dd --- /dev/null +++ b/gnu/test/Result.java @@ -0,0 +1,69 @@ +/************************************************************************* +/* Result.java -- Abstract base class for all Result types. +/* +/* Copyright (c) 1998 Free Software Foundation, Inc. +/* Written by Paul Fisher (rao@gnu.org) +/* +/* This library is free software; you can redistribute it and/or modify +/* it under the terms of the GNU Library General Public License as published +/* by the Free Software Foundation, either version 2 of the License, or +/* (at your option) any later verion. +/* +/* This library is distributed in the hope that it will be useful, but +/* WITHOUT ANY WARRANTY; without even the implied warranty of +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +/* GNU Library General Public License for more details. +/* +/* You should have received a copy of the GNU Library General Public License +/* along with this library; if not, write to the Free Software Foundation +/* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA +/*************************************************************************/ + +package gnu.test; + +/** + * Class which all usable Result objects extend. + */ +public abstract class Result +{ + String name, msg; + + /** + * Create a result of a given type, with a given message. + * + * @param name name of type + * @param msg message + */ + public Result(String name, String msg) { + this.name = name; + this.msg = msg; + } + + /** + * Create a result of a given type. + * + * @param name name of type + */ + public Result(String name) { + this(name, ""); + } + + /** + * Returns the name of the type. + */ + public String getName() { + return name; + } + + /** + * Returns the message associated with this instance of Result, or + * the empty string if no message exists. + */ + public String getMsg() { + return (msg != null) ? msg : ""; + } + + public String toString() { + return getName() + ":" + getMsg(); + } +} diff --git a/gnu/test/Test.java b/gnu/test/Test.java new file mode 100644 index 000000000..f6982a810 --- /dev/null +++ b/gnu/test/Test.java @@ -0,0 +1,41 @@ +/************************************************************************* +/* Test.java -- Interface representing a single test. +/* +/* Copyright (c) 1998 Free Software Foundation, Inc. +/* Written by Paul Fisher (rao@gnu.org) +/* +/* This library is free software; you can redistribute it and/or modify +/* it under the terms of the GNU Library General Public License as published +/* by the Free Software Foundation, either version 2 of the License, or +/* (at your option) any later verion. +/* +/* This library is distributed in the hope that it will be useful, but +/* WITHOUT ANY WARRANTY; without even the implied warranty of +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +/* GNU Library General Public License for more details. +/* +/* You should have received a copy of the GNU Library General Public License +/* along with this library; if not, write to the Free Software Foundation +/* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA +/*************************************************************************/ + +package gnu.test; + +/** + * Interface which all GNU Classpath tests must implement. + * The method <code>test</code> is invoked once for each test. + */ +public interface Test +{ + /** + * Returns the name of the test. + */ + public String getName(); + + /** + * Performs a test. + * + * @return result from running the test + */ + public Result test(); +} diff --git a/gnu/test/Unresolved.java b/gnu/test/Unresolved.java new file mode 100644 index 000000000..2a04104b3 --- /dev/null +++ b/gnu/test/Unresolved.java @@ -0,0 +1,42 @@ +/************************************************************************* +/* Unresolved.java -- Result code returned when test produced +/* indeterminate results. +/* +/* Copyright (c) 1998 Free Software Foundation, Inc. +/* Written by Paul Fisher (rao@gnu.org) +/* +/* This library is free software; you can redistribute it and/or modify +/* it under the terms of the GNU Library General Public License as published +/* by the Free Software Foundation, either version 2 of the License, or +/* (at your option) any later verion. +/* +/* This library is distributed in the hope that it will be useful, but +/* WITHOUT ANY WARRANTY; without even the implied warranty of +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +/* GNU Library General Public License for more details. +/* +/* You should have received a copy of the GNU Library General Public License +/* along with this library; if not, write to the Free Software Foundation +/* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA +/*************************************************************************/ + +package gnu.test; + +/** + * Test produced indeterminate results. + */ +public class Unresolved extends Result +{ + /** + * Constructs an Unresolved result code with additional information. + */ + public Unresolved(String msg) { + super("UNRESOLVED", msg); + } + /** + * Constructs an Unresolved result code. + */ + public Unresolved() { + this(""); + } +} diff --git a/gnu/test/Unsupported.java b/gnu/test/Unsupported.java new file mode 100644 index 000000000..b40407d7d --- /dev/null +++ b/gnu/test/Unsupported.java @@ -0,0 +1,44 @@ +/************************************************************************* +/* Unsupported.java -- Result code returned when test does not have the +/* required support to run. +/* +/* Copyright (c) 1998 Free Software Foundation, Inc. +/* Written by Paul Fisher (rao@gnu.org) +/* +/* This library is free software; you can redistribute it and/or modify +/* it under the terms of the GNU Library General Public License as published +/* by the Free Software Foundation, either version 2 of the License, or +/* (at your option) any later verion. +/* +/* This library is distributed in the hope that it will be useful, but +/* WITHOUT ANY WARRANTY; without even the implied warranty of +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +/* GNU Library General Public License for more details. +/* +/* You should have received a copy of the GNU Library General Public License +/* along with this library; if not, write to the Free Software Foundation +/* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA +/*************************************************************************/ + +package gnu.test; + +/** + * Test does not have the required support to run. For example, + * Unsupported could be returned when a needed resource + * (ie. multicasting) is not available. + */ +public class Unsupported extends Result +{ + /** + * Constructs an Unsupported result code with additional information. + */ + public Unsupported(String msg) { + super("UNSUPPORTED", msg); + } + /** + * Constructs an Unsupported result code. + */ + public Unsupported() { + this(""); + } +} diff --git a/gnu/test/Untested.java b/gnu/test/Untested.java new file mode 100644 index 000000000..f816e8293 --- /dev/null +++ b/gnu/test/Untested.java @@ -0,0 +1,42 @@ +/************************************************************************* +/* Untested.java -- Result code returned when test was not run -- a +/* placeholder. +/* +/* Copyright (c) 1998 Free Software Foundation, Inc. +/* Written by Paul Fisher (rao@gnu.org) +/* +/* This library is free software; you can redistribute it and/or modify +/* it under the terms of the GNU Library General Public License as published +/* by the Free Software Foundation, either version 2 of the License, or +/* (at your option) any later verion. +/* +/* This library is distributed in the hope that it will be useful, but +/* WITHOUT ANY WARRANTY; without even the implied warranty of +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +/* GNU Library General Public License for more details. +/* +/* You should have received a copy of the GNU Library General Public License +/* along with this library; if not, write to the Free Software Foundation +/* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA +/*************************************************************************/ + +package gnu.test; + +/** + * Test was not run -- a placeholder. + */ +public class Untested extends Result +{ + /** + * Constructs an Untested result code with additional information. + */ + public Untested(String msg) { + super("UNTESTED", msg); + } + /** + * Constructs an Untested result code. + */ + public Untested() { + this(""); + } +} diff --git a/gnu/test/XFail.java b/gnu/test/XFail.java new file mode 100644 index 000000000..9b2a808b0 --- /dev/null +++ b/gnu/test/XFail.java @@ -0,0 +1,42 @@ +/************************************************************************* +/* XPass.java -- Result code returned when test failed and was expected to +/* fail. +/* +/* Copyright (c) 1998 Free Software Foundation, Inc. +/* Written by Paul Fisher (rao@gnu.org) +/* +/* This library is free software; you can redistribute it and/or modify +/* it under the terms of the GNU Library General Public License as published +/* by the Free Software Foundation, either version 2 of the License, or +/* (at your option) any later verion. +/* +/* This library is distributed in the hope that it will be useful, but +/* WITHOUT ANY WARRANTY; without even the implied warranty of +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +/* GNU Library General Public License for more details. +/* +/* You should have received a copy of the GNU Library General Public License +/* along with this library; if not, write to the Free Software Foundation +/* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA +/*************************************************************************/ + +package gnu.test; + +/** + * Test failed and was expected to fail. + */ +public class XFail extends Result +{ + /** + * Constructs an XFail result code with additional information. + */ + public XFail(String msg) { + super("XFAIL", msg); + } + /** + * Constructs an XFail result code. + */ + public XFail() { + this(""); + } +} diff --git a/gnu/test/XPass.java b/gnu/test/XPass.java new file mode 100644 index 000000000..a0b4d0b54 --- /dev/null +++ b/gnu/test/XPass.java @@ -0,0 +1,42 @@ +/************************************************************************* +/* XPass.java -- Result code returned when test passed but was expected to +/* fail. +/* +/* Copyright (c) 1998 Free Software Foundation, Inc. +/* Written by Paul Fisher (rao@gnu.org) +/* +/* This library is free software; you can redistribute it and/or modify +/* it under the terms of the GNU Library General Public License as published +/* by the Free Software Foundation, either version 2 of the License, or +/* (at your option) any later verion. +/* +/* This library is distributed in the hope that it will be useful, but +/* WITHOUT ANY WARRANTY; without even the implied warranty of +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +/* GNU Library General Public License for more details. +/* +/* You should have received a copy of the GNU Library General Public License +/* along with this library; if not, write to the Free Software Foundation +/* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA +/*************************************************************************/ + +package gnu.test; + +/** + * Test passed but was expected to fail. + */ +public class XPass extends Result +{ + /** + * Constructs an XPass result code with additional information. + */ + public XPass(String msg) { + super("XPASS", msg); + } + /** + * Constructs an XPass result code. + */ + public XPass() { + this(""); + } +} |