Commit 497ee3d5 authored by Ari Trachtenberg's avatar Ari Trachtenberg
Browse files

changed non-minimal password numbers to warnings, rather than failures

parent ab511ae4
Loading
Loading
Loading
Loading
+19 −8
Original line number Diff line number Diff line
@@ -22,6 +22,17 @@ bool failExample(const char* testName,
    return false;
}

// helper function: consistent warning printing
bool warnExample(const char* testName,
                 const std::string& msg,
                 const std::string& expected,
                 const std::string& got) {
  std::cerr << "[" << testName << " WARNING] " << msg
            << ": expected " << expected << ", got " << got << "\n";
  return false;
}


// helper: string conversion for bool
static string boolStr(bool x) {
    return x ? "true" : "false";
@@ -54,7 +65,7 @@ bool test_0() {

    long got = sys.numPasswords();
    if (got != 3) {
        return failExample(
        warnExample(
                T,
                "triangle graph chromatic number",
                "3",
@@ -91,7 +102,7 @@ bool test_1() {

    long got = sys.numPasswords();
    if (got != 2) {
        return failExample(
        warnExample(
                T,
                "path graph chromatic number",
                "2",
@@ -130,7 +141,7 @@ bool test_2() {

    long got = sys.numPasswords();
    if (got != 2) {
        return failExample(
        warnExample(
                T,
                "4-cycle chromatic number",
                "2",
@@ -169,7 +180,7 @@ bool test_3() {

    long got = sys.numPasswords();
    if (got != 2) {
        return failExample(
        warnExample(
                T,
                "star graph chromatic number",
                "2",
@@ -205,7 +216,7 @@ bool test_4() {

    long got = sys.numPasswords();
    if (got != 4) {
        return failExample(
        warnExample(
                T,
                "K4 chromatic number",
                "4",
@@ -240,7 +251,7 @@ bool test_5() {
    }

    if (sys.numPasswords() != 3) {
        return failExample(
        warnExample(
                T,
                "initial password count before optimization",
                "3",
@@ -261,7 +272,7 @@ bool test_5() {

    long got = sys.numPasswords();
    if (got != 2) {
        return failExample(
        warnExample(
                T,
                "optimized password count for path graph",
                "2",
@@ -301,7 +312,7 @@ bool test_6() {

    long got = sys.numPasswords();
    if (got != 3) {
        return failExample(
        warnExample(
                T,
                "original example graph chromatic number",
                "3",