Skip to content

Commit

Permalink
Add a test for error estimation for integer LHS in assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
PetroZarytskyi authored and vgvassilev committed Mar 12, 2024
1 parent 3153108 commit e78a215
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/ErrorEstimation/Assignments.C
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,27 @@ float func7(float x, float y) { return (x * y); }
//CHECK-NEXT: _final_error += std::abs(1. * _ret_value0 * {{.+}});
//CHECK-NEXT: }

float func8(int x, int y) {
x = y * y;
return x;
}

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

int main() {
clad::estimate_error(func);
clad::estimate_error(func2);
Expand All @@ -173,4 +194,5 @@ int main() {
clad::estimate_error(func5);
clad::estimate_error(func6);
clad::estimate_error(func7);
clad::estimate_error(func8);
}

0 comments on commit e78a215

Please sign in to comment.