Fix nlopt HEAD build
Fix nlopt HEAD build

Add a more complete test that works on HEAD too

Closes #3876.

Signed-off-by: Dominique Orban <b6b12199b0ff1342bf41262c4fcd3a561907b571@gmail.com>

parcollet/homebrew-science,maplesond/homebrew-science,andrewjpage/homebrew-science,heuermh/homebrew-science,pditommaso/homebrew-science,kozo2/homebrew-science,philippbayer/homebrew-science,dpo/homebrew-science,DabeDotCom/homebrew-science,quantumsteve/homebrew-science