astamm / nloptr

nloptr provides an R interface to NLopt, a free/open-source library for nonlinear optimization providing a common interface to a number of different optimization routines which can handle nonlinear constraints and lower and upper bounds for the controls.
https://astamm.github.io/nloptr/
Other
105 stars 35 forks source link

Test hardwires version #90

Closed eddelbuettel closed 2 years ago

eddelbuettel commented 2 years ago

Here we have

> Sys.setenv(PKG_LIBS="-lnlopt")
> Rcpp::cppFunction("std::vector<int> ver() { int ma, mi, bu; nlopt_version(&ma, &mi, &bu); std::vector<int> v = {ma, mi, bu}; return v; }", depends="nloptr", include="#include <nlopt.h>")
> ver()
[1] 2 7 1
> 

yet the test hard wires 2, 7, and 0 which is bound to fail.

astamm commented 2 years ago

I believe your last commit on the PR #88 that I just merged fixes this issue, is that correct?

eddelbuettel commented 2 years ago

Yup. Had to to pass the tests (as I provided 2.7.1). Issue mostly filed to not forget about it and to give you a chance to think about what you want here. The >= may be the best answer -- the minimum version tests is typically done at build time anyway.

astamm commented 2 years ago

I added the >= to major and minor version number as well to pass the unit test for any version >= 2.7.0 in 6e9ec94.