Extract a matrix used to relate test code to the traces that each test evaluates.
Value
A data.frame
with one record for each line of code executed, with
variables:
- test
The index of the test that was executed, reflecting the order in which tests are executed
- depth
The call stack depth when the coverage trace was evaluated
- i
The index of the expression evaluated by each test. This can be used to recover an order of trace execution for a given test index
- trace
The index of the coverage trace that was evaluated
Examples
options(covr.record_tests = TRUE)
pkg_path <- system.file("examplepkg", package = "covtracer")
cov <- covr::package_coverage(pkg_path)
test_trace_mapping(cov)
#> test depth i trace
#> [1,] 1 1 1 9
#> [2,] 2 37 1 18
#> [3,] 2 38 2 14
#> [4,] 2 39 3 23
#> [5,] 2 40 4 24
#> [6,] 2 40 5 26
#> [7,] 2 41 6 24
#> [8,] 2 41 7 26
#> [9,] 2 42 8 24
#> [10,] 2 42 9 26
#> [11,] 2 43 10 24
#> [12,] 2 43 11 27
#> [13,] 3 37 1 23
#> [14,] 3 38 2 24
#> [15,] 3 38 3 26
#> [16,] 3 39 4 24
#> [17,] 3 39 5 26
#> [18,] 3 40 6 24
#> [19,] 3 40 7 26
#> [20,] 3 41 8 24
#> [21,] 3 41 9 27
#> [22,] 4 42 1 18
#> [23,] 4 43 2 14
#> [24,] 4 44 3 23
#> [25,] 4 45 4 24
#> [26,] 4 45 5 26
#> [27,] 4 46 6 24
#> [28,] 4 46 7 26
#> [29,] 4 47 8 24
#> [30,] 4 47 9 26
#> [31,] 4 48 10 24
#> [32,] 4 48 11 27
#> [33,] 5 42 1 18
#> [34,] 5 43 2 14
#> [35,] 5 44 3 23
#> [36,] 5 45 4 24
#> [37,] 5 45 5 26
#> [38,] 5 46 6 24
#> [39,] 5 46 7 26
#> [40,] 5 47 8 24
#> [41,] 5 47 9 26
#> [42,] 5 48 10 24
#> [43,] 5 48 11 27
#> [44,] 6 42 1 18
#> [45,] 6 43 2 14
#> [46,] 6 44 3 23
#> [47,] 6 45 4 24
#> [48,] 6 45 5 26
#> [49,] 6 46 6 24
#> [50,] 6 46 7 26
#> [51,] 6 47 8 24
#> [52,] 6 47 9 26
#> [53,] 6 48 10 24
#> [54,] 6 48 11 27
#> [55,] 7 42 1 18
#> [56,] 7 43 2 14
#> [57,] 7 44 3 23
#> [58,] 7 45 4 24
#> [59,] 7 45 5 26
#> [60,] 7 46 6 24
#> [61,] 7 46 7 26
#> [62,] 7 47 8 24
#> [63,] 7 47 9 26
#> [64,] 7 48 10 24
#> [65,] 7 48 11 27
#> [66,] 8 42 1 18
#> [67,] 8 43 2 14
#> [68,] 8 44 3 23
#> [69,] 8 45 4 24
#> [70,] 8 45 5 26
#> [71,] 8 46 6 24
#> [72,] 8 46 7 26
#> [73,] 8 47 8 24
#> [74,] 8 47 9 26
#> [75,] 8 48 10 24
#> [76,] 8 48 11 27
#> [77,] 9 42 1 18
#> [78,] 9 43 2 14
#> [79,] 9 44 3 23
#> [80,] 9 45 4 24
#> [81,] 9 45 5 26
#> [82,] 9 46 6 24
#> [83,] 9 46 7 26
#> [84,] 9 47 8 24
#> [85,] 9 47 9 26
#> [86,] 9 48 10 24
#> [87,] 9 48 11 27
#> [88,] 10 42 1 18
#> [89,] 10 43 2 14
#> [90,] 10 44 3 23
#> [91,] 10 45 4 24
#> [92,] 10 45 5 26
#> [93,] 10 46 6 24
#> [94,] 10 46 7 26
#> [95,] 10 47 8 24
#> [96,] 10 47 9 26
#> [97,] 10 48 10 24
#> [98,] 10 48 11 27
#> [99,] 11 42 1 18
#> [100,] 11 43 2 14
#> [101,] 11 44 3 23
#> [102,] 11 45 4 24
#> [103,] 11 45 5 26
#> [104,] 11 46 6 24
#> [105,] 11 46 7 26
#> [106,] 11 47 8 24
#> [107,] 11 47 9 26
#> [108,] 11 48 10 24
#> [109,] 11 48 11 27
#> [110,] 12 42 1 18
#> [111,] 12 43 2 14
#> [112,] 12 44 3 23
#> [113,] 12 45 4 24
#> [114,] 12 45 5 26
#> [115,] 12 46 6 24
#> [116,] 12 46 7 26
#> [117,] 12 47 8 24
#> [118,] 12 47 9 26
#> [119,] 12 48 10 24
#> [120,] 12 48 11 27
#> [121,] 13 42 1 18
#> [122,] 13 43 2 14
#> [123,] 13 44 3 23
#> [124,] 13 45 4 24
#> [125,] 13 45 5 26
#> [126,] 13 46 6 24
#> [127,] 13 46 7 26
#> [128,] 13 47 8 24
#> [129,] 13 47 9 26
#> [130,] 13 48 10 24
#> [131,] 13 48 11 27
#> [132,] 14 37 1 6
#> [133,] 15 48 1 6
#> [134,] 16 43 1 7
#> [135,] 17 43 1 7
#> [136,] 18 37 1 15
#> [137,] 18 37 2 28
#> [138,] 19 43 1 10
#> [139,] 19 43 2 1
#> [140,] 20 43 1 2
#> [141,] 20 43 2 20
#> [142,] 20 43 3 16
#> [143,] 21 37 1 4
#> [144,] 21 37 2 8
#> [145,] 22 37 1 13
#> [146,] 22 38 2 5
#> [147,] 23 37 1 13
#> [148,] 23 38 2 17
#> [149,] 24 38 1 21
#> [150,] 25 37 1 19
#> [151,] 25 38 2 25