Skip to content

Commit

Permalink
Simplify CHECK clauses in tests. NFC.
Browse files Browse the repository at this point in the history
  • Loading branch information
vgvassilev committed Dec 16, 2024
1 parent 94016af commit 546c8d6
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 68 deletions.
4 changes: 2 additions & 2 deletions test/ErrorEstimation/BasicOps.C
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ float func4(float x, float y) { return std::pow(x, y); }
//CHECK-NEXT: {
//CHECK-NEXT: float _r0 = 0.F;
//CHECK-NEXT: float _r1 = 0.F;
//CHECK-NEXT: clad::custom_derivatives{{(::std)?}}::pow_pullback(x, y, 1, &_r0, &_r1);
//CHECK-NEXT: clad::custom_derivatives::std::pow_pullback(x, y, 1, &_r0, &_r1);
//CHECK-NEXT: *_d_x += _r0;
//CHECK-NEXT: *_d_y += _r1;
//CHECK-NEXT: }
Expand Down Expand Up @@ -167,7 +167,7 @@ float func5(float x, float y) {
//CHECK-NEXT: float _r_d0 = *_d_y;
//CHECK-NEXT: *_d_y = 0.F;
//CHECK-NEXT: float _r0 = 0.F;
//CHECK-NEXT: _r0 += _r_d0 * clad::custom_derivatives{{(::std)?}}::sin_pushforward(x, 1.F).pushforward;
//CHECK-NEXT: _r0 += _r_d0 * clad::custom_derivatives::std::sin_pushforward(x, 1.F).pushforward;
//CHECK-NEXT: *_d_x += _r0;
//CHECK-NEXT: }
//CHECK-NEXT: _final_error += std::abs(*_d_x * x * {{.+}});
Expand Down
44 changes: 22 additions & 22 deletions test/FirstDerivative/BuiltinDerivatives.C
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ float f2(float x) {

// CHECK: float f2_darg0(float x) {
// CHECK-NEXT: float _d_x = 1;
// CHECK-NEXT: {{(clad::)?}}ValueAndPushforward<float, float> _t0 = clad::custom_derivatives{{(::std)?}}::cos_pushforward(x, _d_x);
// CHECK-NEXT: {{(clad::)?}}ValueAndPushforward<float, float> _t0 = clad::custom_derivatives::cos_pushforward(x, _d_x);
// CHECK-NEXT: return _t0.pushforward;
// CHECK-NEXT: }

Expand All @@ -68,16 +68,16 @@ float f3(float x, float y) {
// CHECK: float f3_darg0(float x, float y) {
// CHECK-NEXT: float _d_x = 1;
// CHECK-NEXT: float _d_y = 0;
// CHECK-NEXT: {{(clad::)?}}ValueAndPushforward<float, float> _t0 = clad::custom_derivatives{{(::std)?}}::sin_pushforward(x, _d_x);
// CHECK-NEXT: {{(clad::)?}}ValueAndPushforward<float, float> _t1 = clad::custom_derivatives{{(::std)?}}::sin_pushforward(y, _d_y);
// CHECK-NEXT: {{(clad::)?}}ValueAndPushforward<float, float> _t0 = clad::custom_derivatives::sin_pushforward(x, _d_x);
// CHECK-NEXT: {{(clad::)?}}ValueAndPushforward<float, float> _t1 = clad::custom_derivatives::sin_pushforward(y, _d_y);
// CHECK-NEXT: return _t0.pushforward + _t1.pushforward;
// CHECK-NEXT: }

// CHECK: float f3_darg1(float x, float y) {
// CHECK-NEXT: float _d_x = 0;
// CHECK-NEXT: float _d_y = 1;
// CHECK-NEXT: {{(clad::)?}}ValueAndPushforward<float, float> _t0 = clad::custom_derivatives{{(::std)?}}::sin_pushforward(x, _d_x);
// CHECK-NEXT: {{(clad::)?}}ValueAndPushforward<float, float> _t1 = clad::custom_derivatives{{(::std)?}}::sin_pushforward(y, _d_y);
// CHECK-NEXT: {{(clad::)?}}ValueAndPushforward<float, float> _t0 = clad::custom_derivatives::sin_pushforward(x, _d_x);
// CHECK-NEXT: {{(clad::)?}}ValueAndPushforward<float, float> _t1 = clad::custom_derivatives::sin_pushforward(y, _d_y);
// CHECK-NEXT: return _t0.pushforward + _t1.pushforward;
// CHECK-NEXT: }

Expand All @@ -88,16 +88,16 @@ float f4(float x, float y) {
// CHECK: float f4_darg0(float x, float y) {
// CHECK-NEXT: float _d_x = 1;
// CHECK-NEXT: float _d_y = 0;
// CHECK-NEXT: {{(clad::)?}}ValueAndPushforward<float, float> _t0 = clad::custom_derivatives{{(::std)?}}::sin_pushforward(x * x, _d_x * x + x * _d_x);
// CHECK-NEXT: {{(clad::)?}}ValueAndPushforward<float, float> _t1 = clad::custom_derivatives{{(::std)?}}::sin_pushforward(y * y, _d_y * y + y * _d_y);
// CHECK-NEXT: {{(clad::)?}}ValueAndPushforward<float, float> _t0 = clad::custom_derivatives::sin_pushforward(x * x, _d_x * x + x * _d_x);
// CHECK-NEXT: {{(clad::)?}}ValueAndPushforward<float, float> _t1 = clad::custom_derivatives::sin_pushforward(y * y, _d_y * y + y * _d_y);
// CHECK-NEXT: return _t0.pushforward + _t1.pushforward;
// CHECK-NEXT: }

// CHECK: float f4_darg1(float x, float y) {
// CHECK-NEXT: float _d_x = 0;
// CHECK-NEXT: float _d_y = 1;
// CHECK-NEXT: {{(clad::)?}}ValueAndPushforward<float, float> _t0 = clad::custom_derivatives{{(::std)?}}::sin_pushforward(x * x, _d_x * x + x * _d_x);
// CHECK-NEXT: {{(clad::)?}}ValueAndPushforward<float, float> _t1 = clad::custom_derivatives{{(::std)?}}::sin_pushforward(y * y, _d_y * y + y * _d_y);
// CHECK-NEXT: {{(clad::)?}}ValueAndPushforward<float, float> _t0 = clad::custom_derivatives::sin_pushforward(x * x, _d_x * x + x * _d_x);
// CHECK-NEXT: {{(clad::)?}}ValueAndPushforward<float, float> _t1 = clad::custom_derivatives::sin_pushforward(y * y, _d_y * y + y * _d_y);
// CHECK-NEXT: return _t0.pushforward + _t1.pushforward;
// CHECK-NEXT: }

Expand All @@ -107,7 +107,7 @@ float f5(float x) {

// CHECK: float f5_darg0(float x) {
// CHECK-NEXT: float _d_x = 1;
// CHECK-NEXT: {{(clad::)?}}ValueAndPushforward<float, float> _t0 = clad::custom_derivatives{{(::std)?}}::exp_pushforward(x, _d_x);
// CHECK-NEXT: {{(clad::)?}}ValueAndPushforward<float, float> _t0 = clad::custom_derivatives::exp_pushforward(x, _d_x);
// CHECK-NEXT: return _t0.pushforward;
// CHECK-NEXT: }

Expand All @@ -117,7 +117,7 @@ float f6(float x) {

// CHECK: float f6_darg0(float x) {
// CHECK-NEXT: float _d_x = 1;
// CHECK-NEXT: {{(clad::)?}}ValueAndPushforward<float, float> _t0 = clad::custom_derivatives{{(::std)?}}::exp_pushforward(x * x, _d_x * x + x * _d_x);
// CHECK-NEXT: {{(clad::)?}}ValueAndPushforward<float, float> _t0 = clad::custom_derivatives::exp_pushforward(x * x, _d_x * x + x * _d_x);
// CHECK-NEXT: return _t0.pushforward;
// CHECK-NEXT: }

Expand All @@ -127,7 +127,7 @@ float f7(float x) {

// CHECK: float f7_darg0(float x) {
// CHECK-NEXT: float _d_x = 1;
// CHECK-NEXT: {{(clad::)?}}ValueAndPushforward<double, double> _t0 = clad::custom_derivatives{{(::std)?}}::pow_pushforward(x, 2., _d_x, 0.);
// CHECK-NEXT: {{(clad::)?}}ValueAndPushforward<double, double> _t0 = clad::custom_derivatives::std::pow_pushforward(x, 2., _d_x, 0.);
// CHECK-NEXT: return _t0.pushforward;
// CHECK-NEXT: }

Expand All @@ -137,7 +137,7 @@ void f7_grad(float x, float *_d_x);
// CHECK-NEXT: {
// CHECK-NEXT: float _r0 = 0.F;
// CHECK-NEXT: double _r1 = 0.;
// CHECK-NEXT: {{(clad::)?}}custom_derivatives{{(::std)?}}::pow_pullback(x, 2., 1, &_r0, &_r1);
// CHECK-NEXT: {{(clad::)?}}custom_derivatives::std::pow_pullback(x, 2., 1, &_r0, &_r1);
// CHECK-NEXT: *_d_x += _r0;
// CHECK-NEXT: }
// CHECK-NEXT: }
Expand All @@ -148,7 +148,7 @@ double f8(float x) {

// CHECK: double f8_darg0(float x) {
// CHECK-NEXT: float _d_x = 1;
// CHECK-NEXT: {{(clad::)?}}ValueAndPushforward<double, double> _t0 = clad::custom_derivatives{{(::std)?}}::pow_pushforward(x, 2, _d_x, 0);
// CHECK-NEXT: {{(clad::)?}}ValueAndPushforward<double, double> _t0 = clad::custom_derivatives::std::pow_pushforward(x, 2, _d_x, 0);
// CHECK-NEXT: return _t0.pushforward;
// CHECK-NEXT: }

Expand All @@ -158,7 +158,7 @@ void f8_grad(float x, float *_d_x);
// CHECK-NEXT: {
// CHECK-NEXT: float _r0 = 0.F;
// CHECK-NEXT: int _r1 = 0;
// CHECK-NEXT: {{(clad::)?}}custom_derivatives{{(::std)?}}::pow_pullback(x, 2, 1, &_r0, &_r1);
// CHECK-NEXT: {{(clad::)?}}custom_derivatives::std::pow_pullback(x, 2, 1, &_r0, &_r1);
// CHECK-NEXT: *_d_x += _r0;
// CHECK-NEXT: }
// CHECK-NEXT: }
Expand All @@ -170,7 +170,7 @@ float f9(float x, float y) {
// CHECK: float f9_darg0(float x, float y) {
// CHECK-NEXT: float _d_x = 1;
// CHECK-NEXT: float _d_y = 0;
// CHECK-NEXT: {{(clad::)?}}ValueAndPushforward<float, float> _t0 = clad::custom_derivatives{{(::std)?}}::pow_pushforward(x, y, _d_x, _d_y);
// CHECK-NEXT: {{(clad::)?}}ValueAndPushforward<float, float> _t0 = clad::custom_derivatives::std::pow_pushforward(x, y, _d_x, _d_y);
// CHECK-NEXT: return _t0.pushforward;
// CHECK-NEXT: }

Expand All @@ -180,7 +180,7 @@ void f9_grad(float x, float y, float *_d_x, float *_d_y);
// CHECK-NEXT: {
// CHECK-NEXT: float _r0 = 0.F;
// CHECK-NEXT: float _r1 = 0.F;
// CHECK-NEXT: {{(clad::)?}}custom_derivatives{{(::std)?}}::pow_pullback(x, y, 1, &_r0, &_r1);
// CHECK-NEXT: {{(clad::)?}}custom_derivatives::std::pow_pullback(x, y, 1, &_r0, &_r1);
// CHECK-NEXT: *_d_x += _r0;
// CHECK-NEXT: *_d_y += _r1;
// CHECK-NEXT: }
Expand All @@ -193,7 +193,7 @@ double f10(float x, int y) {
// CHECK: double f10_darg0(float x, int y) {
// CHECK-NEXT: float _d_x = 1;
// CHECK-NEXT: int _d_y = 0;
// CHECK-NEXT: {{(clad::)?}}ValueAndPushforward<double, double> _t0 = clad::custom_derivatives{{(::std)?}}::pow_pushforward(x, y, _d_x, _d_y);
// CHECK-NEXT: {{(clad::)?}}ValueAndPushforward<double, double> _t0 = clad::custom_derivatives::std::pow_pushforward(x, y, _d_x, _d_y);
// CHECK-NEXT: return _t0.pushforward;
// CHECK-NEXT: }

Expand All @@ -203,7 +203,7 @@ void f10_grad(float x, int y, float *_d_x, int *_d_y);
// CHECK-NEXT: {
// CHECK-NEXT: float _r0 = 0.F;
// CHECK-NEXT: int _r1 = 0;
// CHECK-NEXT: {{(clad::)?}}custom_derivatives{{(::std)?}}::pow_pullback(x, y, 1, &_r0, &_r1);
// CHECK-NEXT: {{(clad::)?}}custom_derivatives::std::pow_pullback(x, y, 1, &_r0, &_r1);
// CHECK-NEXT: *_d_x += _r0;
// CHECK-NEXT: *_d_y += _r1;
// CHECK-NEXT: }
Expand All @@ -218,15 +218,15 @@ double f11(double x, double y) {
// CHECK-NEXT: {
// CHECK-NEXT: double _r0 = 0.;
// CHECK-NEXT: int _r1 = 0;
// CHECK-NEXT: {{(clad::)?}}custom_derivatives{{(::std)?}}::pow_pullback((1. - x), 2, 1, &_r0, &_r1);
// CHECK-NEXT: {{(clad::)?}}custom_derivatives::std::pow_pullback((1. - x), 2, 1, &_r0, &_r1);
// CHECK-NEXT: *_d_x += -_r0;
// CHECK-NEXT: double _r2 = 0.;
// CHECK-NEXT: int _r5 = 0;
// CHECK-NEXT: {{(clad::)?}}custom_derivatives{{(::std)?}}::pow_pullback(y - std::pow(x, 2), 2, 100. * 1, &_r2, &_r5);
// CHECK-NEXT: {{(clad::)?}}custom_derivatives::std::pow_pullback(y - std::pow(x, 2), 2, 100. * 1, &_r2, &_r5);
// CHECK-NEXT: *_d_y += _r2;
// CHECK-NEXT: double _r3 = 0.;
// CHECK-NEXT: int _r4 = 0;
// CHECK-NEXT: {{(clad::)?}}custom_derivatives{{(::std)?}}::pow_pullback(x, 2, -_r2, &_r3, &_r4);
// CHECK-NEXT: {{(clad::)?}}custom_derivatives::std::pow_pullback(x, 2, -_r2, &_r3, &_r4);
// CHECK-NEXT: *_d_x += _r3;
// CHECK-NEXT: }
// CHECK-NEXT: }
Expand Down
4 changes: 2 additions & 2 deletions test/FirstDerivative/CallArguments.C
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ float sqrt_func(float x, float y) {
// CHECK: float sqrt_func_darg0(float x, float y) {
// CHECK-NEXT: float _d_x = 1;
// CHECK-NEXT: float _d_y = 0;
// CHECK-NEXT: ValueAndPushforward<float, float> _t0 = clad::custom_derivatives{{(::std)?}}::sqrt_pushforward(x * x + y * y, _d_x * x + x * _d_x + _d_y * y + y * _d_y);
// CHECK-NEXT: ValueAndPushforward<float, float> _t0 = clad::custom_derivatives::sqrt_pushforward(x * x + y * y, _d_x * x + x * _d_x + _d_y * y + y * _d_y);
// CHECK-NEXT: return _t0.pushforward - _d_y;
// CHECK-NEXT: }

Expand Down Expand Up @@ -219,7 +219,7 @@ int main () { // expected-no-diagnostics
// CHECK-NEXT: double _d_binWidth = ((_d_high - _d_low) * numBins - _t0 * _d_numBins) / (numBins * numBins);
// CHECK-NEXT: double binWidth = _t0 / numBins;
// CHECK-NEXT: double _t1 = (val - low);
// CHECK-NEXT: {{(clad::)?}}ValueAndPushforward<double, double> _t2 = clad::custom_derivatives{{(::std)?}}::abs_pushforward(_t1 / binWidth, ((_d_val - _d_low) * binWidth - _t1 * _d_binWidth) / (binWidth * binWidth));
// CHECK-NEXT: {{(clad::)?}}ValueAndPushforward<double, double> _t2 = clad::custom_derivatives::std::abs_pushforward(_t1 / binWidth, ((_d_val - _d_low) * binWidth - _t1 * _d_binWidth) / (binWidth * binWidth));
// CHECK-NEXT: bool _t3 = val >= high;
// CHECK-NEXT: return {(unsigned int)(_t3 ? numBins - 1 : _t2.value), (unsigned int)(_t3 ? _d_numBins - 0 : _t2.pushforward)};
// CHECK-NEXT: }
Expand Down
4 changes: 2 additions & 2 deletions test/FirstDerivative/FunctionCalls.C
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ float test_6(float x, float y) {
// CHECK: float test_6_darg0(float x, float y) {
// CHECK-NEXT: float _d_x = 1;
// CHECK-NEXT: float _d_y = 0;
// CHECK-NEXT: {{(clad::)?}}ValueAndPushforward<float, float> _t0 = clad::custom_derivatives{{(::std)?}}::sin_pushforward(x, _d_x);
// CHECK-NEXT: {{(clad::)?}}ValueAndPushforward<float, float> _t1 = clad::custom_derivatives{{(::std)?}}::cos_pushforward(y, _d_y);
// CHECK-NEXT: {{(clad::)?}}ValueAndPushforward<float, float> _t0 = clad::custom_derivatives::std::sin_pushforward(x, _d_x);
// CHECK-NEXT: {{(clad::)?}}ValueAndPushforward<float, float> _t1 = clad::custom_derivatives::std::cos_pushforward(y, _d_y);
// CHECK-NEXT: return _t0.pushforward + _t1.pushforward;
// CHECK-NEXT: }

Expand Down
4 changes: 2 additions & 2 deletions test/FirstDerivative/Variables.C
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ double f_sin(double x, double y) {
// CHECK: double f_sin_darg0(double x, double y) {
// CHECK-NEXT: double _d_x = 1;
// CHECK-NEXT: double _d_y = 0;
// CHECK-NEXT: ValueAndPushforward<double, double> _t0 = clad::custom_derivatives{{(::std)?}}::sin_pushforward(x, _d_x);
// CHECK-NEXT: ValueAndPushforward<double, double> _t0 = clad::custom_derivatives::std::sin_pushforward(x, _d_x);
// CHECK-NEXT: double _d_xsin = _t0.pushforward;
// CHECK-NEXT: double xsin = _t0.value;
// CHECK-NEXT: ValueAndPushforward<double, double> _t1 = clad::custom_derivatives{{(::std)?}}::sin_pushforward(y, _d_y);
// CHECK-NEXT: ValueAndPushforward<double, double> _t1 = clad::custom_derivatives::std::sin_pushforward(y, _d_y);
// CHECK-NEXT: double _d_ysin = _t1.pushforward;
// CHECK-NEXT: double ysin = _t1.value;
// CHECK-NEXT: double _d_xt = _d_xsin * xsin + xsin * _d_xsin;
Expand Down
Loading

0 comments on commit 546c8d6

Please sign in to comment.