Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In your example I think you are saying you want to unit test an algorithm that verifies a proposed solution.</p> <p>You'd want to cover the following cases:</p> <ul> <li>Happy path tests to verify that the algorithm accepts a variety of correct solutions</li> <li>Happy path tests to verify that the algorithm rejects a variety of incorrect solutions</li> <li>Sad path tests to ensure that the algorithm correctly handles non-candidates (e.g. a "solution" with 7 queens instead of 8, etc.)</li> </ul> <p>Here, "a variety" means that you want the solutions to cover the space of possibilities. But what it means to cover that space is problem-specific. I'm not familiar enough with the N-queens problem to know what variety exists across correct solutions, but that information would be useful were I to implement tests. Regarding incorrect solutions, you'd want some involving the same rank, same file, same diagonal, and a mix. Some involving exposure along the edge of the board and some involving exposure off the edge. Etc.</p> <p>Also, if you have information about the distribution of solutions, you might prioritize those that are more likely, though in the end you'll want to cover even those solutions that are less likely since those are the ones that tend to break things in real life.</p> <p>Also if the algorithm is complicated then it makes sense to decompose it into parts and test the correctness of those parts in much the same way (distinguish happy from sad path, and test inputs of both sort).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload