|
| 1 | +/**************************************************************************************[reloc64.cc] |
| 2 | +Copyright (c) 2021, Norbert Manthey |
| 3 | +
|
| 4 | +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and |
| 5 | +associated documentation files (the "Software"), to deal in the Software without restriction, |
| 6 | +including without limitation the rights to use, copy, modify, merge, publish, distribute, |
| 7 | +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is |
| 8 | +furnished to do so, subject to the following conditions: |
| 9 | +
|
| 10 | +The above copyright notice and this permission notice shall be included in all copies or |
| 11 | +substantial portions of the Software. |
| 12 | +
|
| 13 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT |
| 14 | +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 15 | +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
| 16 | +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT |
| 17 | +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 18 | +**************************************************************************************************/ |
| 19 | + |
| 20 | +#include "tests/TestSolver.h" |
| 21 | + |
| 22 | +using namespace MERGESAT_NSPACE; |
| 23 | + |
| 24 | +bool TestSolver::test_entrypoint() |
| 25 | +{ |
| 26 | + /* Make sure the values are as expected after solving */ |
| 27 | + test_assert(okay(), "solver has to be okay"); |
| 28 | + |
| 29 | + test_assert(clauses.size() == 1, "there is a clause to work with"); |
| 30 | + |
| 31 | + CRef r = clauses[0]; |
| 32 | + Clause &c = ca[r]; |
| 33 | + |
| 34 | + CRef new_ref = (1UL << 33) + 3UL; |
| 35 | + c.relocate(new_ref); |
| 36 | + CRef c_ref = c.relocation(); |
| 37 | + |
| 38 | + test_assert(new_ref == c_ref, "stored ref should be working"); |
| 39 | + |
| 40 | + return true; |
| 41 | +} |
| 42 | + |
| 43 | +int main(int argc, char **argv) |
| 44 | +{ |
| 45 | + TestSolver solver; |
| 46 | + |
| 47 | + solver.verbosity = 0; |
| 48 | + |
| 49 | + while (solver.nVars() < 2) solver.newVar(); |
| 50 | + |
| 51 | + solver.addClause(mkLit(1), mkLit(2)); |
| 52 | + |
| 53 | + bool status = solver.solve(); |
| 54 | + |
| 55 | + test_assert(status == true, "The given formula has to be satisfiable"); |
| 56 | + |
| 57 | + status = solver.test_entrypoint(); |
| 58 | + test_assert(status == true, "Relocation should be successful."); |
| 59 | + return 0; |
| 60 | +} |
0 commit comments