Skip to content

Commit

Permalink
basic time limit assertion #15
Browse files Browse the repository at this point in the history
  • Loading branch information
piccolbo committed Apr 27, 2015
1 parent 9a494d8 commit 3f4053f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
1 change: 0 additions & 1 deletion pkg/DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ Date: 2015-04-22
Author: Revolution Analytics
Imports: digest, functional, testthat, pryr, microbenchmark, dplyr, bitops
Suggests: covr
Collate: quickcheck.R generators.R
Maintainer: Revolution Analytics <[email protected]>
URL: https://github.com/RevolutionAnalytics/quickcheck
Description: Provides functions to test and reproduce failures of assertions on random data. Also provides a variety of random data generators.
Expand Down
1 change: 1 addition & 0 deletions pkg/NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export(qc.option)
export(default)
export(`%||%`)
export(forall)
export(assert.time.limit)
S3method(coverage, character)
S3method(print, TestSet)
importFrom(functional, Curry)
Expand Down
22 changes: 22 additions & 0 deletions pkg/R/performance.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2015 Revolution Analytics
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#


assert.time.limit =
function(expr, cpu = Inf, elapsed = Inf) {
setTimeLimit(cpu, elapsed, TRUE)
retval = eval.parent(expr)
setTimeLimit(Inf, Inf, TRUE)
TRUE}

0 comments on commit 3f4053f

Please sign in to comment.