protected void runTestOnData(Instances data) {
    // count numeric atts
    int numeric = 0;
    for (int n = 0; n < data.numAttributes(); n++) {
      if (data.attribute(n).isNumeric())
	numeric++;
    }
    
    // perform tests
    for (int n = 0; n < data.numInstances(); n++) {
      try {
	AlgVector v = new AlgVector(data.instance(n));
	
	// 1. is length correct?
	assertEquals((n+1) + ": length differs", numeric, v.numElements());
	
	// 2. are values correct?
	int index = 0;
	for (int i = 0; i < data.numAttributes(); i++) {
	  if (!data.attribute(i).isNumeric())
	    continue;
	  assertEquals((n+1) + "/" + (i+1) + ": value differs", data.instance(n).value(i), v.getElement(index));
	  index++;
	}
	
	// 3. is instance returned correct?
	Instance inst = v.getAsInstance(data, new Random(1));
	for (int i = 0; i < data.numAttributes(); i++) {
	  if (!data.attribute(i).isNumeric())
	    continue;
	  assertEquals((n+1) + "/" + (i+1) + ": returned value differs", data.instance(n).value(i), inst.value(i));
	}
      }
      catch (Exception e) {
	if (!(e instanceof IllegalArgumentException))
	  fail(e.toString());
      }
    }
  }