|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--com.topcoder.shared.problem.BaseElement
|
+--com.topcoder.shared.problem.TestCase
This class represents a test case. It can be either an example test case (as shown in a problem statement),
or it may represent a system test case (the former are actually instances of the latter). All test cases
consist of one or more input strings and one output string. Example test cases may have an optional
annotation, represented as an Element.
Element,
Serialized Form| Field Summary | |
static java.lang.String |
ERROR
What the output will be equal to if an error occurred during generation of the output. |
static java.lang.String |
UNKNOWN_OUTPUT
What the output will be equal to if the output is unknown. |
| Constructor Summary | |
TestCase()
Empty constructor required by custom serialization. |
|
TestCase(java.lang.String[] input,
Element annotation,
boolean example)
Constructs a TestCase whos output is yet unknown. |
|
TestCase(java.lang.String[] input,
java.lang.String output,
boolean example)
Constructs an unannotated test case. |
|
TestCase(java.lang.String[] input,
java.lang.String output,
Element annotation,
boolean example)
|
|
| Method Summary | |
void |
customReadObject(com.topcoder.shared.netCommon.CSReader reader)
Custom serialization |
void |
customWriteObject(com.topcoder.shared.netCommon.CSWriter writer)
Custom serialization |
static java.lang.String |
encodeHTML(java.lang.String text)
Utility function for encoding HTML entities in text. |
boolean |
equals(java.lang.Object obj)
Whether this test case equals another test case. |
Element |
getAnnotation()
Returns the annotation associated with this test case. |
java.lang.String[] |
getInput()
Returns the string representations of the input values as an array. |
java.lang.String |
getOutput()
Returns the string representation of the expected output for this test case. |
ElementRenderer |
getRenderer()
Returns this elements renderer. |
boolean |
isExample()
True if this test case is an example test case. |
void |
setExample(boolean example)
Set's whether the test case is an example or system test case. |
void |
setOutput(java.lang.String output)
Set's the string representation of the expected output for this test case. |
void |
setRenderer(ElementRenderer renderer)
Sets the renderer for this element. |
java.lang.String |
toXML()
Returns the XML representation of this element. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.topcoder.shared.problem.Element |
getRenderer, setRenderer |
| Field Detail |
public static final java.lang.String UNKNOWN_OUTPUT
public static final java.lang.String ERROR
| Constructor Detail |
public TestCase()
public TestCase(java.lang.String[] input,
java.lang.String output,
boolean example)
input - An array of input values. The first value should be the value for the first argument, etc.output - A string representation of the expected output for this test case.example - Specifies whether or not this is an example test case.
public TestCase(java.lang.String[] input,
java.lang.String output,
Element annotation,
boolean example)
input - An array of input values. The first value should be the value for the first argument, etc.output - A string representation of the expected output for this test case.annotation - An Element representing a writer's annotation, or explanation of this test case.
This value can be null if no annotation exists, and should only be non-null
when example is true.example - Specifies whether or not this is an example test case.Element
public TestCase(java.lang.String[] input,
Element annotation,
boolean example)
input - An array of input values. The first value should be the value for the first argument, etc.annotation - An Element representing a writer's annotation, or explanation of this test case.
This value can be null if no annotation exists, and should only be non-null
when example is true.example - Specifies whether or not this is an example test case.Element| Method Detail |
public void customWriteObject(com.topcoder.shared.netCommon.CSWriter writer)
throws java.io.IOException
customWriteObject in interface Elementwriter - the writer to write to.
java.io.IOException - if an I/O error has occurred in the stream that backs the writer.
public void customReadObject(com.topcoder.shared.netCommon.CSReader reader)
throws java.io.IOException,
java.io.ObjectStreamException
customReadObject in interface Elementreader - the reader to read from.
java.io.ObjectStreamException - if the information that is read is inconsistent (stream corrupted
or incompatibility between writers and readers)
java.io.IOException - if an I/O error has occurred in the stream that backs the reader.public boolean isExample()
public void setExample(boolean example)
example - true if the test case is an example or false if it's a system test case.public java.lang.String[] getInput()
ProblemComponent.getParamTypes()public void setOutput(java.lang.String output)
output - the string representation of the expected output for this test case.public java.lang.String getOutput()
ProblemComponent.getReturnType()public Element getAnnotation()
null if no
annotation exists.
public java.lang.String toXML()
<test-case example="1"><input>encoded value</input><input>...</input><output>encoded value</output><annotation>text</annotation></test-case>.
toXML in interface Elementpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic void setRenderer(ElementRenderer renderer)
setRenderer in interface Elementrenderer - the element renderer.ElementRendererpublic ElementRenderer getRenderer()
getRenderer in interface ElementElementRendererpublic static java.lang.String encodeHTML(java.lang.String text)
text - the text to encode.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||