Skip to content

Commit

Permalink
ready for CRAN release
Browse files Browse the repository at this point in the history
version bump
set minimum R patchlevel to 0
more images now work thanks to backend improvements
included test summary covrpage
  • Loading branch information
jonocarroll committed Apr 27, 2018
1 parent 394b256 commit 9dc4e85
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 8 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: mathpix
Title: Support for the 'Mathpix' API (Image to 'LaTeX')
Version: 0.2.0
Version: 0.3.0
Authors@R: person("Jonathan", "Carroll",
email = "[email protected]",
role = c("aut", "cre"),
Expand All @@ -12,7 +12,7 @@ Description: Given an image of a formula (typeset or handwritten) this package
See <https://docs.mathpix.com/> for full details. 'Mathpix' is an external service
and use of the API is subject to their terms and conditions.
Depends:
R (>= 3.3.2)
R (>= 3.3.0)
License: GPL (>=3)
Encoding: UTF-8
LazyData: true
Expand All @@ -21,7 +21,7 @@ BugReports: https://github.com/jonocarroll/mathpix/issues
Suggests:
testthat,
covr
RoxygenNote: 6.0.1
RoxygenNote: 6.0.1.9000
Imports:
purrr,
base64enc,
Expand Down
8 changes: 8 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# mathpix 0.3.0

* Maintenance release
* More images work thanks to backend improvements from Mathpix service.
(updated tests accordingly).
* Included covrpage test summary (see https://github.com/jonocarroll/mathpix/tree/master/tests)
* Adjusted dependence to patchlevel 0

# mathpix 0.2.0

* Ability to not insert the LaTeX block `(insert = FALSE)`.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
mathpix
=======

[![Project Status: Active - The project has reached a stable, usable state and is being actively developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active) [![CRAN\_Status\_Badge](http://www.r-pkg.org/badges/version/mathpix)](https://cran.r-project.org/package=mathpix) [![packageversion](https://img.shields.io/badge/Package%20version-0.2.0-orange.svg?style=flat-square)](commits/master) [![Last-changedate](https://img.shields.io/badge/last%20change-2017--10--18-yellowgreen.svg)](/commits/master)
[![Project Status: Active - The project has reached a stable, usable state and is being actively developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active) [![CRAN\_Status\_Badge](http://www.r-pkg.org/badges/version/mathpix)](https://cran.r-project.org/package=mathpix) [![packageversion](https://img.shields.io/badge/Package%20version-0.2.0-orange.svg?style=flat-square)](commits/master) [![Last-changedate](https://img.shields.io/badge/last%20change-2018--04--27-yellowgreen.svg)](/commits/master)

[![Linux/Mac Travis Build Status](https://img.shields.io/travis/jonocarroll/mathpix/master.svg?label=Mac%20OSX%20%26%20Linux)](https://travis-ci.org/jonocarroll/mathpix) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/jonocarroll/mathpix?branch=master&svg=true)](https://ci.appveyor.com/project/jonocarroll/mathpix) [![codecov](https://codecov.io/gh/jonocarroll/mathpix/branch/master/graph/badge.svg)](https://codecov.io/gh/jonocarroll/mathpix)

Expand Down
36 changes: 36 additions & 0 deletions tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Tests and Coverage
================
27 April, 2018 22:06:07

- [Coverage](#coverage)
- [Unit Tests](#unit-tests)

This output is created by [covrpage](https://github.com/yonicd/covrpage).

Coverage
--------

Coverage summary is created using the [covr](https://github.com/r-lib/covr) package.

| Object | Coverage (%) |
|:------------------------------|:------------:|
| mathpix | 9.68 |
| [R/connect.R](../R/connect.R) | 9.68 |

<br>

Unit Tests
----------

Unit Test summary is created using the [testthat](https://github.com/r-lib/testthat) package.

| file | n| time| error| failed| skipped| warning|
|:-----------------------------------|----:|------:|------:|-------:|--------:|--------:|
| [test\_api.R](testthat/test_api.R) | 5| 4.394| 0| 0| 0| 0|

| file | test | context | status | n| time|
|:-----------------------------------|:--------------------------------------------|:----------------|:-------|----:|------:|
| [test\_api.R](testthat/test_api.R) | eq1 returns correct LaTeX | Connect to API | PASS | 1| 1.066|
| [test\_api.R](testthat/test_api.R) | Travis successfully uses API key | Connect to API | PASS | 1| 0.792|
| [test\_api.R](testthat/test_api.R) | Retrying image processing can be successful | Connect to API | PASS | 2| 2.533|
| [test\_api.R](testthat/test_api.R) | Missing image produces an error | File processing | PASS | 1| 0.003|
11 changes: 7 additions & 4 deletions tests/testthat/test_api.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@ test_that("Travis successfully uses API key", {

test_that("Retrying image processing can be successful", {
skip_on_cran()
## this one should fail
expect_error(suppressWarnings(mathpix(system.file("extdata", "eq_no_05_screencapfixes.jpg", package = "mathpix"), insert = FALSE, retry = FALSE)))
## this one no longer fails
expect_equal(gsub(" ", "", suppressWarnings(mathpix(system.file("extdata", "eq_no_05_screencapfixes.jpg", package = "mathpix"), insert = FALSE, retry = FALSE))),
gsub(" ", "", "$$
p _ { i } ( \\theta ) = c _ { i } + \\frac { 1- c _ { i } } { 1+ e ^ { - a _ { i } ( \\theta - b _ { i } ) } }
$$"))
## this one should work
expect_equal(suppressWarnings(mathpix(system.file("extdata", "eq_no_05_screencapfixes.jpg", package = "mathpix"), insert = FALSE, retry = TRUE)),
"$$\n p _ { i } ( \\theta ) = c _ { i } + \\frac { 1- c _ { i } } { 1+ e ^ { - a _ { i } \\theta - b _ { i } ) } } \n$$")
expect_equal(gsub(" ", "", suppressWarnings(mathpix(system.file("extdata", "eq_no_05_screencapfixes.jpg", package = "mathpix"), insert = FALSE, retry = TRUE))),
gsub(" ", "", "$$\n p _ { i } ( \\theta ) = c _ { i } + \\frac { 1- c _ { i } } { 1+ e ^ { - a _ { i } (\\theta - b _ { i } ) } } \n$$"))
})

context("File processing")
Expand Down

0 comments on commit 9dc4e85

Please sign in to comment.