FileDocCategorySizeDatePackage
CSVTest.javaAPI DocExample1417Sun Feb 22 17:46:32 GMT 2004None

CSVTest

public class CSVTest extends TestCase
author
ian

Fields Summary
CSV
csv
String[]
data
int[]
listLength
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

		junit.textui.TestRunner.run(CSVTest.class);
	
public voidtestBarDelim()
Test one String with a non-default delimiter

		// Now test slightly-different string with a non-default separator
		CSV parser = new CSV('|"); 
		List l = parser.parse(
			"\"LU\"|86.25|\"11/4/1998\"|\"2:19PM\"|+4.0625");
		assertEquals(l.size(), 5);
		Iterator it = l.iterator();
		while (it.hasNext()) {
			System.out.print("[" + it.next() + "],");
		}
		System.out.println();
	
public voidtestCSV()
test all the Strings in "data"

	
	       
	   
		for (int i = 0; i < data.length; i++){
			List l = csv.parse(data[i]);
			assertEquals(l.size() , listLength[i]);
			for (int k = 0; k < l.size(); k++){
				System.out.print("[" + l.get(k) + "],");
			}
			System.out.println();
		}