// Path: src/test/java/org/deri/tarql/Helpers.java
// public static Binding binding(List<Var> header, String... values) {
// 	if (header.size() != values.length) {
// 		throw new IllegalArgumentException(
// 				"header and values must have same length: " + 
// 						header + ", " + Arrays.toString(values));
// 	}
// 	BindingHashMap result = new BindingHashMap();
// 	for (int i = 0; i < header.size(); i++) {
// 		result.add(header.get(i), NodeFactoryExtra.parseNode(values[i]));
// 	}
// 	return result;
// }
// 
// Path: src/test/java/org/deri/tarql/Helpers.java
// public static Binding removePseudoVars(Binding binding) {
// 	BindingHashMap result = new BindingHashMap();
// 	Iterator<Var> it = binding.vars();
// 	while (it.hasNext()) {
// 		Var var = it.next();
// 		if (var.equals(TarqlQuery.ROWNUM)) continue;
// 		result.add(var, binding.get(var));
// 	}
// 	return result;
// }
// 
// Path: src/test/java/org/deri/tarql/Helpers.java
// public static List<Var> vars(String... names) {
// 	List<Var> result = new ArrayList<Var>(names.length);
// 	for (String name: names) {
// 		result.add(Var.alloc(name));
// 	}
// 	return result;
// }


import static org.deri.tarql.Helpers.binding;
import static org.deri.tarql.Helpers.removePseudoVars;
import static org.deri.tarql.Helpers.vars;
import static org.junit.Assert.assertEquals;
import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.apache.jena.sparql.core.Var;
import org.apache.jena.sparql.engine.binding.Binding;
import org.junit.Test;
	}
	
	@Test
	public void testAssignNewNameToReservedColumnName() throws IOException {
		String csv = "ROWNUM";
		assertEquals(vars("a"), getNonPseudoVars(csv, true));
	}
	
	@Test
	public void testIncludesROWNUM() throws IOException {
		String csv = "a,b";
		assertEquals(vars("a", "b", "ROWNUM"), readCSV(csv, true).getVars());
	}
	
	@Test
	public void testEmptyColumn() throws IOException {
		String csv = "x,,y";
		assertEquals(vars("a", "b", "c"), getNonPseudoVars(csv, false));
	}

	@Test
	public void testTabSeparated() throws IOException {
		String csv = "foo\tbar\n1\t2";
		List<Var> vars = vars("foo", "bar");
		assertEquals(binding(vars, "\"1\"", "\"2\""), removePseudoVars(readCSV(csv, true, '\t', '"').next()));
	}
	
	@Test
	public void testSemicolonSeparated() throws IOException {
		String csv = "foo;bar\n1,5;2,0";
// Path: src/test/java/org/deri/tarql/Helpers.java
// public static Binding binding(List<Var> header, String... values) {
// 	if (header.size() != values.length) {
// 		throw new IllegalArgumentException(
// 				"header and values must have same length: " + 
// 						header + ", " + Arrays.toString(values));
// 	}
// 	BindingHashMap result = new BindingHashMap();
// 	for (int i = 0; i < header.size(); i++) {
// 		result.add(header.get(i), NodeFactoryExtra.parseNode(values[i]));
// 	}
// 	return result;
// }
// 
// Path: src/test/java/org/deri/tarql/Helpers.java
// public static Binding removePseudoVars(Binding binding) {
// 	BindingHashMap result = new BindingHashMap();
// 	Iterator<Var> it = binding.vars();
// 	while (it.hasNext()) {
// 		Var var = it.next();
// 		if (var.equals(TarqlQuery.ROWNUM)) continue;
// 		result.add(var, binding.get(var));
// 	}
// 	return result;
// }
// 
// Path: src/test/java/org/deri/tarql/Helpers.java
// public static List<Var> vars(String... names) {
// 	List<Var> result = new ArrayList<Var>(names.length);
// 	for (String name: names) {
// 		result.add(Var.alloc(name));
// 	}
// 	return result;
// }


// Path: src/test/java/org/deri/tarql/CSVParserTest.java
import static org.deri.tarql.Helpers.binding;
import static org.deri.tarql.Helpers.removePseudoVars;
import static org.deri.tarql.Helpers.vars;
import static org.junit.Assert.assertEquals;
import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.apache.jena.sparql.core.Var;
import org.apache.jena.sparql.engine.binding.Binding;
import org.junit.Test;

	}
	
	@Test
	public void testAssignNewNameToReservedColumnName() throws IOException {
		String csv = "ROWNUM";
		assertEquals(vars("a"), getNonPseudoVars(csv, true));
	}
	
	@Test
	public void testIncludesROWNUM() throws IOException {
		String csv = "a,b";
		assertEquals(vars("a", "b", "ROWNUM"), readCSV(csv, true).getVars());
	}
	
	@Test
	public void testEmptyColumn() throws IOException {
		String csv = "x,,y";
		assertEquals(vars("a", "b", "c"), getNonPseudoVars(csv, false));
	}

	@Test
	public void testTabSeparated() throws IOException {
		String csv = "foo\tbar\n1\t2";
		List<Var> vars = vars("foo", "bar");
		assertEquals(binding(vars, "\"1\"", "\"2\""), removePseudoVars(readCSV(csv, true, '\t', '"').next()));
	}
	
	@Test
	public void testSemicolonSeparated() throws IOException {
		String csv = "foo;bar\n1,5;2,0";
		assertEquals(binding(vars("foo", "bar"), "\"1,5\"", "\"2,0\""), 