File indexing completed on 2024-05-19 04:06:07

0001 /* Copyright (c) 2019 Shlomi Fish
0002  *
0003  * Permission is hereby granted, free of charge, to any person
0004  * obtaining a copy of this software and associated documentation
0005  * files (the "Software"), to deal in the Software without
0006  * restriction, including without limitation the rights to use,
0007  * copy, modify, merge, publish, distribute, sublicense, and/or sell
0008  * copies of the Software, and to permit persons to whom the
0009  * Software is furnished to do so, subject to the following
0010  * conditions:
0011  *
0012  * The above copyright notice and this permission notice shall be
0013  * included in all copies or substantial portions of the Software.
0014  *
0015  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
0016  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
0017  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
0018  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
0019  * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
0020  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
0021  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
0022  * OTHER DEALINGS IN THE SOFTWARE.
0023  */
0024 #include <QProcess>
0025 #include <QTest>
0026 
0027 class TestSolver: public QObject
0028 {
0029     Q_OBJECT
0030 private Q_SLOTS:
0031     void runSolver();
0032 };
0033 
0034 void TestSolver::runSolver()
0035 {
0036     QProcess kpat;
0037     const char *const deal = "830910836";
0038     kpat.start(QStringLiteral("../bin/kpat"), QStringList() << QStringLiteral("--start") << deal << QStringLiteral("--end") << deal << QStringLiteral("--solve") << QStringLiteral("3"));
0039     QCOMPARE(kpat.waitForFinished(), true);
0040     QCOMPARE(kpat.exitStatus(), QProcess::NormalExit);
0041     QCOMPARE(kpat.exitCode(), 0);
0042 }
0043 
0044 QTEST_MAIN(TestSolver)
0045 #include "freecell_solver.moc"