Skip to content

Commit

Permalink
Improve test coverage of VisitCallExpr
Browse files Browse the repository at this point in the history
  • Loading branch information
PetroZarytskyi committed Mar 13, 2024
1 parent 067ab71 commit 8dbc74b
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/Gradient/FunctionCalls.C
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,25 @@ double fn14(double x, double y) {
// CHECK-NEXT: }
// CHECK-NEXT: }

double fn15(double x, double y) {
A::constantFn(y += x);
return y;
}

//CHECK: void fn15_grad(double x, double y, clad::array_ref<double> _d_x, clad::array_ref<double> _d_y) {
//CHECK-NEXT: double _t0;
//CHECK-NEXT: _t0 = y;
//CHECK-NEXT: A::constantFn(y += x);
//CHECK-NEXT: goto _label0;
//CHECK-NEXT: _label0:
//CHECK-NEXT: * _d_y += 1;
//CHECK-NEXT: {
//CHECK-NEXT: y = _t0;
//CHECK-NEXT: double _r_d0 = * _d_y;
//CHECK-NEXT: * _d_x += _r_d0;
//CHECK-NEXT: }
//CHECK-NEXT: }

template<typename T>
void reset(T* arr, int n) {
for (int i=0; i<n; ++i)
Expand Down Expand Up @@ -778,4 +797,6 @@ int main() {

INIT(fn14);
TEST2(fn14, 3, 5); // CHECK-EXEC: {1.00, 1.00}
INIT(fn15);
TEST2(fn15, 6, -2) // CHECK-EXEC: {1.00, 1.00}
}

0 comments on commit 8dbc74b

Please sign in to comment.