stan-dev / math

The Stan Math Library is a C++ template library for automatic differentiation of any order using forward, reverse, and mixed modes. It includes a range of built-in functions for probabilistic modeling, linear algebra, and equation solving.
https://mc-stan.org
BSD 3-Clause "New" or "Revised" License
754 stars 188 forks source link

testing/Missing Prim Tests #1194

Open drezap opened 5 years ago

drezap commented 5 years ago

Description

A few files found by @roualdes in thread The Flattening Refactor are empty and need tests written. The files I need write tests for are:

Expected Output

Tests are written.

Current Version:

v2.19.0

drezap commented 5 years ago

@increasechief is there already an issue for this? feel free to close this and post a link to that one, if that's ok

ghost commented 5 years ago

Sorry. No I was going to confirm that this is the branch: https://github.com/stan-dev/math/tree/code-cleanup/issue-937-flatten.

There may be some helpful test cases in {arr,scal,mat}/err/

I have a habit of trying to close the dialogue box and mistakenly closing the issue.

ghost commented 5 years ago

I'm interested if I can help you with this.

There is some additional new development, for example the current LDLT_function.cpp file uses the check_square function, which is part of a set which variously throw exceptions or domain errors. There are now the is_square (pending the merge of #1187) function which is in a set of tests which will return a boolean operator. An additional thought is that it shouldn't be necessary to write test cases which also confirm that the correct error messages are being thrown.

drezap commented 5 years ago

I'm interested if I can help you with this.

sure, if you want. I'm starting from the top, it's really easy stuff.

it shouldn't be necessary to write test cases which also confirm that the correct error messages are being thrown.

I slightly disagree, as I've been testing correct error message are thrown for other functions, and this kinda goes against the "all changes tested" guideline.

There is some additional new development

Sure, we can divide and conquer. Feel free to just assign me stuff (easy to keep track this way), as long as there's no intersect between the work so we're not overlapping.

ghost commented 5 years ago

Assuming that no check functions are included, barring other sources, no error messages will be thrown and the code will still have all of the same check function assurances in place. Maybe that's not what they are ultimately intended for...

Mostly I was looking to figure out where the branch for this is being kept. I have it now. My issue is that I'm really slow going over things for the first time. I'll try to get one finished tonight, probably dot_product_test.

bob-carpenter commented 5 years ago

No rush. The idea of having the check functions is that we'd eventually rewrite the validate functions in terms of the check functions. And we'd expose both to the Stan language so that users can put them in their own functions.

ghost commented 5 years ago

Which are the validate functions? I only know of /prim/mat/err/validate_non_negative_index.hpp.