Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
QueryR
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Julien Lopez
QueryR
Commits
e5bb6f6b
Commit
e5bb6f6b
authored
6 years ago
by
Tomas Stupka
Browse files
Options
Downloads
Plain Diff
[GR-2798] Enable tck tests temporarily disabled in #
40bda55e
.
PullRequest: fastr/1470
parents
53f5c6c9
c50dc499
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
com.oracle.truffle.r.test.tck/src/com/oracle/truffle/r/test/tck/RTCKLanguageProvider.java
+84
-73
84 additions, 73 deletions
...c/com/oracle/truffle/r/test/tck/RTCKLanguageProvider.java
with
84 additions
and
73 deletions
com.oracle.truffle.r.test.tck/src/com/oracle/truffle/r/test/tck/RTCKLanguageProvider.java
+
84
−
73
View file @
e5bb6f6b
...
@@ -127,12 +127,6 @@ public final class RTCKLanguageProvider implements LanguageProvider {
...
@@ -127,12 +127,6 @@ public final class RTCKLanguageProvider implements LanguageProvider {
TypeDescriptor
numOrBoolOrNullOrArrNumBool
=
TypeDescriptor
.
union
(
numOrBoolOrNull
,
arrNumBool
);
TypeDescriptor
numOrBoolOrNullOrArrNumBool
=
TypeDescriptor
.
union
(
numOrBoolOrNull
,
arrNumBool
);
TypeDescriptor
boolOrArrBool
=
TypeDescriptor
.
union
(
TypeDescriptor
.
BOOLEAN
,
TypeDescriptor
.
array
(
TypeDescriptor
.
BOOLEAN
));
TypeDescriptor
boolOrArrBool
=
TypeDescriptor
.
union
(
TypeDescriptor
.
BOOLEAN
,
TypeDescriptor
.
array
(
TypeDescriptor
.
BOOLEAN
));
// TODO cause occasional and more then occasional fails on gate builds
// TypeDescriptor strOrNumOrBool = TypeDescriptor.union(TypeDescriptor.STRING, numOrBool);
// TypeDescriptor arrStrNumBool = TypeDescriptor.array(strOrNumOrBool);
// TypeDescriptor strOrNumOrBoolOrArrStrNumBool = TypeDescriptor.union(strOrNumOrBool,
// arrStrNumBool);
// +
// +
ops
.
add
(
createBinaryOperator
(
context
,
"+"
,
numOrBoolOrArrNumBool
,
numOrBoolOrNullOrArrNumBool
,
numOrBoolOrNullOrArrNumBool
,
ops
.
add
(
createBinaryOperator
(
context
,
"+"
,
numOrBoolOrArrNumBool
,
numOrBoolOrNullOrArrNumBool
,
numOrBoolOrNullOrArrNumBool
,
RResultVerifier
.
newBuilder
(
numOrBoolOrNullOrArrNumBool
,
numOrBoolOrNullOrArrNumBool
).
emptyArrayCheck
().
build
()));
RResultVerifier
.
newBuilder
(
numOrBoolOrNullOrArrNumBool
,
numOrBoolOrNullOrArrNumBool
).
emptyArrayCheck
().
build
()));
...
@@ -146,37 +140,24 @@ public final class RTCKLanguageProvider implements LanguageProvider {
...
@@ -146,37 +140,24 @@ public final class RTCKLanguageProvider implements LanguageProvider {
ops
.
add
(
createBinaryOperator
(
context
,
"/"
,
numOrBoolOrArrNumBool
,
numOrBoolOrNullOrArrNumBool
,
numOrBoolOrNullOrArrNumBool
,
ops
.
add
(
createBinaryOperator
(
context
,
"/"
,
numOrBoolOrArrNumBool
,
numOrBoolOrNullOrArrNumBool
,
numOrBoolOrNullOrArrNumBool
,
RResultVerifier
.
newBuilder
(
numOrBoolOrNullOrArrNumBool
,
numOrBoolOrNullOrArrNumBool
).
emptyArrayCheck
().
build
()));
RResultVerifier
.
newBuilder
(
numOrBoolOrNullOrArrNumBool
,
numOrBoolOrNullOrArrNumBool
).
emptyArrayCheck
().
build
()));
// TODO cause occasional and more then occasional fails on gate builds
// <
// <
// ops.add(createBinaryOperator(context, "<", boolOrArrBool, strOrNumOrBoolOrArrStrNumBool,
ops
.
add
(
createBinaryOperator
(
context
,
"<"
,
boolOrArrBool
,
TypeDescriptor
.
ANY
,
TypeDescriptor
.
ANY
,
// strOrNumOrBoolOrArrStrNumBool,
RResultVerifier
.
newBuilder
(
TypeDescriptor
.
ANY
,
TypeDescriptor
.
ANY
).
compareParametersCheck
().
build
()));
// RResultVerifier.newBuilder(strOrNumOrBoolOrArrStrNumBool,
// >
// strOrNumOrBoolOrArrStrNumBool).mixedArraysCheck().emptyArrayCheck().build()));
ops
.
add
(
createBinaryOperator
(
context
,
">"
,
boolOrArrBool
,
TypeDescriptor
.
ANY
,
TypeDescriptor
.
ANY
,
// // >
RResultVerifier
.
newBuilder
(
TypeDescriptor
.
ANY
,
TypeDescriptor
.
ANY
).
compareParametersCheck
().
build
()));
// ops.add(createBinaryOperator(context, ">", boolOrArrBool, strOrNumOrBoolOrArrStrNumBool,
// <=
// strOrNumOrBoolOrArrStrNumBool,
ops
.
add
(
createBinaryOperator
(
context
,
"<="
,
boolOrArrBool
,
TypeDescriptor
.
ANY
,
TypeDescriptor
.
ANY
,
// RResultVerifier.newBuilder(strOrNumOrBoolOrArrStrNumBool,
RResultVerifier
.
newBuilder
(
TypeDescriptor
.
ANY
,
TypeDescriptor
.
ANY
).
compareParametersCheck
().
build
()));
// strOrNumOrBoolOrArrStrNumBool).mixedArraysCheck().emptyArrayCheck().build()));
// >=
// // <=
ops
.
add
(
createBinaryOperator
(
context
,
">="
,
boolOrArrBool
,
TypeDescriptor
.
ANY
,
TypeDescriptor
.
ANY
,
// ops.add(createBinaryOperator(context, "<=", boolOrArrBool, strOrNumOrBoolOrArrStrNumBool,
RResultVerifier
.
newBuilder
(
TypeDescriptor
.
ANY
,
TypeDescriptor
.
ANY
).
compareParametersCheck
().
build
()));
// strOrNumOrBoolOrArrStrNumBool,
// ==
// RResultVerifier.newBuilder(strOrNumOrBoolOrArrStrNumBool,
ops
.
add
(
createBinaryOperator
(
context
,
"=="
,
boolOrArrBool
,
TypeDescriptor
.
ANY
,
TypeDescriptor
.
ANY
,
// strOrNumOrBoolOrArrStrNumBool).mixedArraysCheck().emptyArrayCheck().build()));
RResultVerifier
.
newBuilder
(
TypeDescriptor
.
ANY
,
TypeDescriptor
.
ANY
).
compareParametersCheck
().
build
()));
// // >=
// !=
// ops.add(createBinaryOperator(context, ">=", boolOrArrBool, strOrNumOrBoolOrArrStrNumBool,
ops
.
add
(
createBinaryOperator
(
context
,
"!="
,
boolOrArrBool
,
TypeDescriptor
.
ANY
,
TypeDescriptor
.
ANY
,
// strOrNumOrBoolOrArrStrNumBool,
RResultVerifier
.
newBuilder
(
TypeDescriptor
.
ANY
,
TypeDescriptor
.
ANY
).
compareParametersCheck
().
build
()));
// RResultVerifier.newBuilder(strOrNumOrBoolOrArrStrNumBool,
// strOrNumOrBoolOrArrStrNumBool).mixedArraysCheck().emptyArrayCheck().build()));
// // ==
// ops.add(createBinaryOperator(context, "==", boolOrArrBool, strOrNumOrBoolOrArrStrNumBool,
// strOrNumOrBoolOrArrStrNumBool,
// RResultVerifier.newBuilder(strOrNumOrBoolOrArrStrNumBool,
// strOrNumOrBoolOrArrStrNumBool).mixedArraysCheck().emptyArrayCheck().build()));
// // !=
// ops.add(createBinaryOperator(context, "!=", boolOrArrBool, strOrNumOrBoolOrArrStrNumBool,
// strOrNumOrBoolOrArrStrNumBool,
// RResultVerifier.newBuilder(strOrNumOrBoolOrArrStrNumBool,
// strOrNumOrBoolOrArrStrNumBool).mixedArraysCheck().emptyArrayCheck().build()));
// // TODO &, |, &&, ||
// // TODO &, |, &&, ||
// !
// !
...
@@ -485,44 +466,74 @@ public final class RTCKLanguageProvider implements LanguageProvider {
...
@@ -485,44 +466,74 @@ public final class RTCKLanguageProvider implements LanguageProvider {
return
this
;
return
this
;
}
}
// TODO cause occasional and more then occasional fails on gate builds
// - not empty homogenous number, boolean or string arrays -> vector
// Todo: Is it R bug or should verifier handle this?
// - any other array -> list
// [1,"TEST"] < [1,2] works
// [1,"TEST"] < [1,"TEST"] fails
// Builder mixedArraysCheck() {
// chain = new BiFunction<Boolean, SnippetRun, Void>() {
// private final BiFunction<Boolean, SnippetRun, Void> next = chain;
//
// @Override
// public Void apply(Boolean valid, SnippetRun sr) {
// if (valid && sr.getException() != null && areMixedArrays(sr.getParameters())) {
// return null;
// }
// return next.apply(valid, sr);
// }
//
//
// private boolean areMixedArrays(List<? extends Value> args) {
// comparing:
// for (Value arg : args) {
// - null with anything does not fail - logical(0)
// if (!arg.hasArrayElements()) {
// - empty list or vector with anything does not fail - logical(0)
// return false;
// - atomic vectors does not fail
// }
// - a list with an atomic vector does not fail
// boolean str = false;
// - a list with another list FAILS
// boolean num = false;
// - other kind of object with anything but null or empty list or vector FAILS
// for (int i = 0; i < arg.getArraySize(); i++) {
Builder
compareParametersCheck
()
{
// TypeDescriptor td = TypeDescriptor.forValue(arg.getArrayElement(i));
chain
=
new
BiFunction
<
Boolean
,
SnippetRun
,
Void
>()
{
// str |= TypeDescriptor.STRING.isAssignable(td);
private
final
BiFunction
<
Boolean
,
SnippetRun
,
Void
>
next
=
chain
;
// num |= TypeDescriptor.NUMBER.isAssignable(td) ||
// TypeDescriptor.BOOLEAN.isAssignable(td);
@Override
// }
public
Void
apply
(
Boolean
valid
,
SnippetRun
sr
)
{
// if ((!str & !num) || (str ^ num)) {
if
(
valid
&&
sr
.
getException
()
!=
null
&&
expectsException
(
sr
.
getParameters
()))
{
// return false;
return
null
;
// }
}
// }
return
next
.
apply
(
valid
,
sr
);
// return !args.isEmpty();
}
// }
// };
private
boolean
expectsException
(
List
<?
extends
Value
>
args
)
{
// return this;
boolean
parametersValid
=
false
;
// }
int
mixed
=
0
;
for
(
Value
arg
:
args
)
{
parametersValid
=
false
;
if
(
arg
.
isNull
())
{
// one of the given parameters is NULL
// this is never expected to fail
return
false
;
}
if
(
arg
.
isNumber
()
||
arg
.
isString
()
||
arg
.
isBoolean
())
{
parametersValid
=
true
;
}
else
if
(
arg
.
hasArrayElements
())
{
if
(
arg
.
getArraySize
()
==
0
)
{
// one of the given parameters is an emtpy list or vector,
// this is never expected to fail
return
false
;
}
else
{
boolean
str
=
false
;
boolean
num
=
false
;
boolean
other
=
false
;
for
(
int
i
=
0
;
i
<
arg
.
getArraySize
();
i
++)
{
TypeDescriptor
td
=
TypeDescriptor
.
forValue
(
arg
.
getArrayElement
(
i
));
if
(
TypeDescriptor
.
STRING
.
isAssignable
(
td
))
{
str
=
true
;
}
else
if
(
TypeDescriptor
.
NUMBER
.
isAssignable
(
td
)
||
TypeDescriptor
.
BOOLEAN
.
isAssignable
(
td
))
{
num
=
true
;
}
else
{
other
=
true
;
}
}
parametersValid
=
!
other
;
if
(
str
&&
num
)
{
mixed
++;
}
}
}
if
(!
parametersValid
)
{
break
;
}
}
return
!(
parametersValid
&&
mixed
<
args
.
size
());
}
};
return
this
;
}
RResultVerifier
build
()
{
RResultVerifier
build
()
{
return
new
RResultVerifier
(
expectedParameterTypes
,
chain
);
return
new
RResultVerifier
(
expectedParameterTypes
,
chain
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment