Skip to content

Commit

Permalink
Automatically Verify R’s Output (#806)
Browse files Browse the repository at this point in the history
  • Loading branch information
EagleoutIce committed May 18, 2024
2 parents 7a2ce0a + a2f4458 commit f1debbb
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions test/functionality/slicing/static-program-slices/simple-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ x <- 1
for(i in 1:10) {
x <- x * 2
}
cat(x)
`, ['6@x'], 'x <- 1\nfor(i in 1:10) x <- x * 2\nx')
print(x)
`, ['6@x'], 'x <- 1\nfor(i in 1:10) x <- x * 2\nx', {
expectedOutput: '[1] 1024'
})
assertSliced(label('While-Loop', ['name-normal', 'while-loop', 'newlines', 'numbers', 'unnamed-arguments', ...OperatorDatabase['<-'].capabilities, 'function-calls', ...OperatorDatabase['*'].capabilities, 'precedence']),
shell, `
x <- 1
Expand Down Expand Up @@ -54,11 +56,13 @@ i <- 3
if(i > 3) {
x <- x * 2
}
cat(x)
print(x)
`, ['7@x'], `x <- 1
i <- 3
if(i > 3) { x <- x * 2 }
x`)
x`, {
expectedOutput: '[1] 1'
})
})
describe('Access', () => {
assertSliced(label('constant', ['name-normal', 'numbers', ...OperatorDatabase['<-'].capabilities, 'newlines', 'unnamed-arguments', 'single-bracket-access']),
Expand Down Expand Up @@ -139,7 +143,9 @@ cat("Product:", product, "\\n")
`sum <- 0
w <- 7
N <- 10
for(i in 1:(N-1)) sum <- sum + i + w`
for(i in 1:(N-1)) sum <- sum + i + w`, {
expectedOutput: 'Sum: 108\nProduct: 362880'
}
)

assertSliced(label('Sum rhs in for', capabilities),
Expand Down Expand Up @@ -185,7 +191,5 @@ product`
shell, code, ['2@sum'],
'sum <- 0'
)

})

}))

2 comments on commit f1debbb

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"artificial" Benchmark Suite

Benchmark suite Current: f1debbb Previous: eddce74 Ratio
Retrieve AST from R code 238.8336137727273 ms 282.3815673181818 ms 0.85
Normalize R AST 31.118704863636363 ms 36.45953090909091 ms 0.85
Produce dataflow information 57.55216468181818 ms 66.17186054545455 ms 0.87
Total per-file 1256.893017909091 ms 1557.712024590909 ms 0.81
Static slicing 1.2632292479551874 ms (1.0556762753942461) 1.4160048835200516 ms (1.1715105189277293) 0.89
Reconstruct code 0.4030129064943434 ms (0.22092272265168386) 0.48975330853571625 ms (0.2799126163528146) 0.82
Total per-slice 1.6837904860419037 ms (1.111907709415937) 1.9280102618968917 ms (1.2491682419110006) 0.87
failed to reconstruct/re-parse 0 # 0 # 1
times hit threshold 0 # 0 # 1
reduction (characters) 0.797431685913541 # 0.797431685913541 # 1
reduction (normalized tokens) 0.7740577588998524 # 0.7740577588998524 # 1

This comment was automatically generated by workflow using github-action-benchmark.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"social-science" Benchmark Suite

Benchmark suite Current: f1debbb Previous: eddce74 Ratio
Retrieve AST from R code 238.78901294 ms 236.60308994 ms 1.01
Normalize R AST 31.772646899999998 ms 31.77161632 ms 1.00
Produce dataflow information 82.09837470000001 ms 81.86384715999999 ms 1.00
Total per-file 2684.95976582 ms 2674.55292236 ms 1.00
Static slicing 5.431153248693768 ms (10.168066709564293) 5.448939336693711 ms (10.154387662460568) 1.00
Reconstruct code 0.3733751841643544 ms (0.20120886208805838) 0.35616079097800935 ms (0.1827576285958724) 1.05
Total per-slice 5.813618025217021 ms (10.233659680139624) 5.814113487370482 ms (10.211794878365124) 1.00
failed to reconstruct/re-parse 2 # 2 # 1
times hit threshold 0 # 0 # 1
reduction (characters) 0.9244759792036856 # 0.9241844105867956 # 1.00
reduction (normalized tokens) 0.8924953600737399 # 0.8924953600737399 # 1

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.