summaryrefslogtreecommitdiff
path: root/cross-project-tests/debuginfo-tests/dexter/feature_tests/commands/perfect/expect_watch_value.cpp
blob: 593488b8099598b5a530858af4f65e475ecd9910 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Purpose:
//      Check that \DexExpectWatchValue applies no penalties when expected
//      values are found.
//
// UNSUPPORTED: system-darwin
//
// RUN: %dexter_regression_test_cxx_build %s -o %t
// RUN: %dexter_regression_test_run --binary %t -- %s | FileCheck %s
// CHECK: expect_watch_value.cpp:

unsigned long Factorial(int n) {
    volatile unsigned long fac = 1; // DexLabel('entry')

    for (int i = 1; i <= n; ++i)
        fac *= i;                   // DexLabel('loop')

    return fac;                     // DexLabel('ret')
}

int main()
{
    return Factorial(8);
}

/*
DexExpectWatchValue('n', '8', on_line=ref('entry'))
DexExpectWatchValue('i',
                    '1', '2', '3', '4', '5', '6', '7', '8',
                    on_line=ref('loop'))

DexExpectWatchValue('fac',
                    '1', '2', '6', '24', '120', '720', '5040',
                     on_line=ref('loop'))

DexExpectWatchValue('n', '8', on_line=ref('loop'))
DexExpectWatchValue('fac', '40320', on_line=ref('ret'))
DexExpectWatchValue('n', '8', on_line=ref('ret'))
*/