*/
public class StandarizationOperatorTest {
@Test
public void testConstructorOfStandarizationOperator() {
CellAddressFactory caf;
Relation input;
StandarizationOperator standOper;
Formulas expectedResult;
Formulas resultFormulas;
Relation resRelation;
caf = new CellAddressFactory(1);
input = caf.getSpaceForNewRelation(1);//(a)
standOper = new StandarizationOperator(caf, input);
resultFormulas = standOper.getFormulas();
expectedResult = new Formulas();
expectedResult.put(new Cell('B',1), "IF(ISNA($A1),0,1)");
expectedResult.put(new Cell('C',1), "MATCH(ROW(),$B:$B,0)");
expectedResult.put(new Cell('D',1), "INDEX(A:A,$C1)");
expectedResult.put(new Cell('B',2), "IF(ISNA($A2),B1,B1+1)");
expectedResult.put(new Cell('C',2), "MATCH(ROW(),$B:$B,0)");
expectedResult.put(new Cell('D',2), "INDEX(A:A,$C2)");
// System.out.println("expected:");
// System.out.println(expectedResult.toString(caf));
// System.out.println("real");
// System.out.println(resultFormulas.toString(caf));
assertEquals(expectedResult, resultFormulas);
resRelation = standOper.getResultRelation();
assertEquals(new Column('D'), resRelation.getFirstCol());
assertEquals(1, resRelation.getCardinality());
caf = new CellAddressFactory(1);
input = caf.getSpaceForNewRelation(2);//(a,b)
standOper = new StandarizationOperator(caf, input);
resultFormulas = standOper.getFormulas();
expectedResult = new Formulas();
expectedResult.put(new Cell('C',1), "IF(ISNA($A1),0,1)");
expectedResult.put(new Cell('D',1), "MATCH(ROW(),$C:$C,0)");
expectedResult.put(new Cell('E',1), "INDEX(A:A,$D1)");
expectedResult.put(new Cell('F',1), "INDEX(B:B,$D1)");
expectedResult.put(new Cell('C',2), "IF(ISNA($A2),C1,C1+1)");
expectedResult.put(new Cell('D',2), "MATCH(ROW(),$C:$C,0)");
expectedResult.put(new Cell('E',2), "INDEX(A:A,$D2)");
expectedResult.put(new Cell('F',2), "INDEX(B:B,$D2)");
// System.out.println("expected:");
// System.out.println(expectedResult.toString(caf));
// System.out.println("real");
// System.out.println(resultFormulas.toString(caf));
assertEquals(expectedResult, resultFormulas);
resRelation = standOper.getResultRelation();
assertEquals(new Column('E'), resRelation.getFirstCol());
assertEquals(2, resRelation.getCardinality());
caf = new CellAddressFactory(2);//zaczynamy od B
input = caf.getSpaceForNewRelation(3);//(b,c,d)
standOper = new StandarizationOperator(caf, input);
resultFormulas = standOper.getFormulas();
expectedResult = new Formulas();
expectedResult.put(new Cell('E',1), "IF(ISNA($B1),0,1)");
expectedResult.put(new Cell('F',1), "MATCH(ROW(),$E:$E,0)");