Skip to content

Commit

Permalink
use existing lambda method with fullPath=true config
Browse files Browse the repository at this point in the history
  • Loading branch information
keenkeystrokes committed Nov 26, 2024
1 parent 8f74853 commit eb9a9aa
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@ function meta::pure::metamodel::serialization::grammar::printInstanceValue(i:Ins
f:FunctionDefinition<Any>[1] | $f->printFunctionDefinition($configuration, $space+' '),
f:FunctionExpression[1] | $f->printPropertyOrFunctionExpression($configuration, $space),
cs:ColSpec<Any>[1] | '~' + $cs.name->printColName(),
fsc:FuncColSpec<Any, Any>[1] | '~' + $fsc.name->printColName() + ':' + $fsc.function->cast(@FunctionDefinition<Any>)->printFunctionDefinition(''),
asc:AggColSpec<Any, Any, Any>[1] | '~' + $asc.name->printColName() + ':' + $asc.map->cast(@FunctionDefinition<Any>)->printFunctionDefinition('') + ':' + $asc.reduce->cast(@FunctionDefinition<Any>)->printFunctionDefinition(''),
fsc:FuncColSpec<Any, Any>[1] | '~' + $fsc.name->printColName() + ':' + $fsc.function->cast(@FunctionDefinition<Any>)->printFunctionDefinition($configuration, ''),
asc:AggColSpec<Any, Any, Any>[1] | '~' + $asc.name->printColName() + ':' + $asc.map->cast(@FunctionDefinition<Any>)->printFunctionDefinition($configuration, '') + ':' + $asc.reduce->cast(@FunctionDefinition<Any>)->printFunctionDefinition(''),
csa:ColSpecArray<Any>[1] | '~['+$csa.names->map(c|$c->printColName())->joinStrings(',')+']',
fcsa:FuncColSpecArray<Any, Any>[1] | '~[' + $fcsa.funcSpecs->map(x| $x.name->printColName() + ':' + $x.function->cast(@FunctionDefinition<Any>)->printFunctionDefinition(''))->joinStrings(',') + ']',
acsa:AggColSpecArray<Any, Any, Any>[1] | '~[' + $acsa.aggSpecs->map(x| $x.name->printColName() + ':' + $x.map->cast(@FunctionDefinition<Any>)->printFunctionDefinition('') + ':' + $x.reduce->cast(@FunctionDefinition<Any>)->printFunctionDefinition(''))->joinStrings(',') + ']',
fcsa:FuncColSpecArray<Any, Any>[1] | '~[' + $fcsa.funcSpecs->map(x| $x.name->printColName() + ':' + $x.function->cast(@FunctionDefinition<Any>)->printFunctionDefinition($configuration, ''))->joinStrings(',') + ']',
acsa:AggColSpecArray<Any, Any, Any>[1] | '~[' + $acsa.aggSpecs->map(x| $x.name->printColName() + ':' + $x.map->cast(@FunctionDefinition<Any>)->printFunctionDefinition($configuration, '') + ':' + $x.reduce->cast(@FunctionDefinition<Any>)->printFunctionDefinition($configuration, ''))->joinStrings(',') + ']',
x:InstanceValue[1] | $x->printInstanceValue($configuration, $space),
z:KeyExpression[*] | $z->map(f|$f.key.values->toOne()->toString())->joinStrings(','),
v:VariableExpression[1] | $v->printValueSpecification($configuration, $space),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ function <<test.Test>> meta::external::dataquality::tests::testLambdaGeneration_
' assertion: row2|$row2.FIRSTNAME->isNotEmpty();' +
' }' +
' ];' +
' }','validFirstName', {|#>{meta::external::dataquality::tests::domain::db.personTable}#->select(~[FIRSTNAME, LASTNAME])->extend(~fullname:x|[$x.FIRSTNAME->toOne(), $x.LASTNAME->toOne()]->joinStrings())->filter(row2|$row2.FIRSTNAME->isNotEmpty()->not())
' }','validFirstName', {|#>{meta::external::dataquality::tests::domain::db.personTable}#->select(~[FIRSTNAME, LASTNAME])->extend(~fullname:x|[$x.FIRSTNAME->meta::pure::functions::multiplicity::toOne(), $x.LASTNAME->meta::pure::functions::multiplicity::toOne()]->joinStrings())->filter(row2|$row2.FIRSTNAME->meta::pure::functions::collection::isNotEmpty()->meta::pure::functions::boolean::not())
})
}

Expand All @@ -202,6 +202,6 @@ function <<test.Test>> meta::external::dataquality::tests::testLambdaGeneration_
' assertion: row2|$row2.FIRSTNAME->size() <= 100;' +
' }' +
' ];' +
' }','validFirstName', {name:String[1]|#>{meta::external::dataquality::tests::domain::db.personTable}#->select(~FIRSTNAME)->filter({n|($n == $name)})->groupBy(~[FIRSTNAME], ~[count:{x|$x.FIRSTNAME}:{y|$y->count()}])->filter(row2|not(($row2.FIRSTNAME->size() <= 100)))
' }','validFirstName', {name:String[1]|#>{meta::external::dataquality::tests::domain::db.personTable}#->select(~FIRSTNAME)->filter({n|($n == $name)})->groupBy(~[FIRSTNAME], ~[count:{x|$x.FIRSTNAME}:{y|$y->meta::pure::functions::collection::count()}])->filter(row2|meta::pure::functions::boolean::not(($row2.FIRSTNAME->meta::pure::functions::collection::size() <= 100)))
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,18 @@ function meta::external::dataquality::tests::doRelationTest(dq:String[1], valida
{
let dataqualityRelationValidation = $dq->loadDataQualityRelationValidation();

let actual = $dataqualityRelationValidation->meta::external::dataquality::generateDataqualityRelationValidationLambda($validationName);
let actual = $dataqualityRelationValidation->meta::external::dataquality::generateDataqualityRelationValidationLambda($validationName, []);

assertRelationLambdaEquals($expected, $actual);
assertLambdaEquals($expected, $actual->cast(@LambdaFunction<Any>));
}

function meta::external::dataquality::tests::doRelationTestWithLimit(dq:String[1], validationName:String[1], expected:FunctionDefinition<Any>[1], resultLimit: Integer[1]):Boolean[1]
{
let dataqualityRelationValidation = $dq->loadDataQualityRelationValidation();

let actual = $dataqualityRelationValidation->meta::external::dataquality::generateDataqualityRelationValidationLambda($validationName, $resultLimit);

assertLambdaEquals($expected, $actual->cast(@LambdaFunction<Any>));
}


Expand All @@ -88,15 +97,6 @@ function meta::external::dataquality::tests::assertLambdaEquals(expected:Functio
assertEquals($expected->printFunctionDefinition($config, ''), $actual->printFunctionDefinition($config, ''));
}

function meta::external::dataquality::tests::assertRelationLambdaEquals(expected:FunctionDefinition<Any>[1], actual:FunctionDefinition<Any>[1]): Boolean[1]
{
let config = ^meta::pure::metamodel::serialization::grammar::Configuration
(
fullPath = false
);
assertEquals($expected->printFunctionDefinition($config, ''), $actual->printFunctionDefinition($config, ''));
}

function meta::external::dataquality::tests::assertLambdaJSONEquals(expected:FunctionDefinition<Any>[1], actual:FunctionDefinition<Any>[1]): Boolean[1]
{
assertEquals($expected->functionJSON(), $actual->functionJSON());
Expand Down

0 comments on commit eb9a9aa

Please sign in to comment.