Global Metrics

path: .metrics.nom.functions
old: 4.0
new: 10.0

path: .metrics.nom.total
old: 4.0
new: 10.0

path: .metrics.cognitive.sum
old: 9.0
new: 23.0

path: .metrics.cognitive.average
old: 2.25
new: 2.3

path: .metrics.cyclomatic.sum
old: 24.0
new: 34.0

path: .metrics.cyclomatic.average
old: 3.4285714285714284
new: 2.6153846153846154

path: .metrics.loc.ploc
old: 174.0
new: 186.0

path: .metrics.loc.cloc
old: 14.0
new: 28.0

path: .metrics.loc.sloc
old: 199.0
new: 260.0

path: .metrics.loc.blank
old: 11.0
new: 46.0

path: .metrics.loc.lloc
old: 64.0
new: 80.0

path: .metrics.nexits.sum
old: 8.0
new: 17.0

path: .metrics.nexits.average
old: 2.0
new: 1.7

path: .metrics.mi.mi_original
old: 33.997691289902946
new: 27.793000723440173

path: .metrics.mi.mi_sei
old: -4.236844165870128
new: -7.803528407939176

path: .metrics.mi.mi_visual_studio
old: 19.881690812808746
new: 16.253216797333433

path: .metrics.halstead.n1
old: 28.0
new: 23.0

path: .metrics.halstead.effort
old: 254686.39060577992
new: 191298.73266158724

path: .metrics.halstead.difficulty
old: 38.60606060606061
new: 31.478102189781023

path: .metrics.halstead.length
old: 901.0
new: 830.0

path: .metrics.halstead.purity_ratio
old: 1.1814272603473128
new: 1.296954602837233

path: .metrics.halstead.N2
old: 364.0
new: 375.0

path: .metrics.halstead.level
old: 0.025902668759811617
new: 0.03176811594202898

path: .metrics.halstead.n2
old: 132.0
new: 137.0

path: .metrics.halstead.time
old: 14149.243922543328
new: 10627.70737008818

path: .metrics.halstead.estimated_program_length
old: 1064.4659615729288
new: 1076.472320354903

path: .metrics.halstead.volume
old: 6597.057213493514
new: 6077.200318756511

path: .metrics.halstead.N1
old: 537.0
new: 455.0

path: .metrics.halstead.bugs
old: 1.339314501047791
new: 1.1066751051550203

path: .metrics.nargs.average
old: 2.0
new: 0.9

path: .metrics.nargs.sum
old: 8.0
new: 9.0

Spaces Data

Minimal test - lines (35, 258)

path: .spaces[0].metrics.nargs.sum
old: 8.0
new: 9.0

path: .spaces[0].metrics.nargs.average
old: 2.0
new: 0.9

path: .spaces[0].metrics.cyclomatic.sum
old: 23.0
new: 33.0

path: .spaces[0].metrics.cyclomatic.average
old: 3.8333333333333335
new: 2.75

path: .spaces[0].metrics.loc.sloc
old: 178.0
new: 224.0

path: .spaces[0].metrics.loc.lloc
old: 64.0
new: 80.0

path: .spaces[0].metrics.loc.blank
old: 9.0
new: 42.0

path: .spaces[0].metrics.loc.cloc
old: 8.0
new: 17.0

path: .spaces[0].metrics.loc.ploc
old: 161.0
new: 165.0

path: .spaces[0].metrics.nexits.average
old: 2.0
new: 1.7

path: .spaces[0].metrics.nexits.sum
old: 8.0
new: 17.0

path: .spaces[0].metrics.halstead.N2
old: 352.0
new: 358.0

path: .spaces[0].metrics.halstead.vocabulary
old: 148.0
new: 144.0

path: .spaces[0].metrics.halstead.length
old: 889.0
new: 813.0

path: .spaces[0].metrics.halstead.level
old: 0.02435064935064935
new: 0.02939033276657761

path: .spaces[0].metrics.halstead.bugs
old: 1.369013652915989
new: 1.1336504951911

path: .spaces[0].metrics.halstead.volume
old: 6409.204042044136
new: 5829.149026172599

path: .spaces[0].metrics.halstead.estimated_program_length
old: 963.4328092906352
new: 941.2243766995372

path: .spaces[0].metrics.halstead.N1
old: 537.0
new: 455.0

path: .spaces[0].metrics.halstead.difficulty
old: 41.06666666666667
new: 34.02479338842975

path: .spaces[0].metrics.halstead.n1
old: 28.0
new: 23.0

path: .spaces[0].metrics.halstead.n2
old: 120.0
new: 121.0

path: .spaces[0].metrics.halstead.effort
old: 263204.64599327923
new: 198335.59124588917

path: .spaces[0].metrics.halstead.purity_ratio
old: 1.083726444646384
new: 1.157717560516036

path: .spaces[0].metrics.halstead.time
old: 14622.480332959958
new: 11018.643958104954

path: .spaces[0].metrics.cognitive.sum
old: 9.0
new: 23.0

path: .spaces[0].metrics.cognitive.average
old: 2.25
new: 2.3

path: .spaces[0].metrics.mi.mi_visual_studio
old: 21.160559399255693
new: 17.926360923312096

path: .spaces[0].metrics.mi.mi_sei
old: -5.0279267377559975
new: -7.419132620879299

path: .spaces[0].metrics.mi.mi_original
old: 36.18455657272723
new: 30.654077178863687

path: .spaces[0].metrics.nom.functions
old: 4.0
new: 10.0

path: .spaces[0].metrics.nom.total
old: 4.0
new: 10.0

Code

namespace {

static uint32_t gFailCount = 0;

/**
 * Prints the given failure message and arguments using printf, prepending
 * "TEST-UNEXPECTED-FAIL " for the benefit of the test harness and
 * appending "\n" to eliminate having to type it at each call site.
 */
MOZ_FORMAT_PRINTF(1, 2) void fail(const char* msg, ...) {
  va_list ap;

  printf("TEST-UNEXPECTED-FAIL | ");

  va_start(ap, msg);
  vprintf(msg, ap);
  va_end(ap);

  putchar('\n');
  ++gFailCount;
}

//-----------------------------------------------------------------------------

class ScopedXPCOM final : public nsIDirectoryServiceProvider2 {
 public:
  NS_DECL_ISUPPORTS

  explicit ScopedXPCOM(const char* testName,
                       nsIDirectoryServiceProvider* dirSvcProvider = nullptr)
      : mDirSvcProvider(dirSvcProvider) {
    mTestName = testName;
    printf("Running %s tests...\n", mTestName);

    nsresult rv = NS_InitXPCOM(&mServMgr, nullptr, this);
    if (NS_FAILED(rv)) {
      fail("NS_InitXPCOM returned failure code 0x%" PRIx32,
           static_cast(rv));
      mServMgr = nullptr;
      return;
    }
  }

  ~ScopedXPCOM() {
    // If we created a profile directory, we need to remove it.
    if (mProfD) {
      nsCOMPtr os =
          do_GetService(NS_OBSERVERSERVICE_CONTRACTID);
      MOZ_ASSERT(os);
      if (os) {
        MOZ_ALWAYS_SUCCEEDS(os->NotifyObservers(
            nullptr, "profile-change-net-teardown", nullptr));
        MOZ_ALWAYS_SUCCEEDS(
            os->NotifyObservers(nullptr, "profile-change-teardown", nullptr));
        MOZ_ALWAYS_SUCCEEDS(
            os->NotifyObservers(nullptr, "profile-before-change", nullptr));
        MOZ_ALWAYS_SUCCEEDS(
            os->NotifyObservers(nullptr, "profile-before-change-qm", nullptr));
        MOZ_ALWAYS_SUCCEEDS(os->NotifyObservers(
            nullptr, "profile-before-change-telemetry", nullptr));
      }

      if (NS_FAILED(mProfD->Remove(true))) {
        NS_WARNING("Problem removing profile directory");
      }

      mProfD = nullptr;
    }

    if (mServMgr) {
      NS_RELEASE(mServMgr);
      nsresult rv = NS_ShutdownXPCOM(nullptr);
      if (NS_FAILED(rv)) {
        fail("XPCOM shutdown failed with code 0x%" PRIx32,
             static_cast(rv));
        exit(1);
      }
    }

    printf("Finished running %s tests.\n", mTestName);
  }

  already_AddRefed GetProfileDirectory() {
    if (mProfD) {
      nsCOMPtr copy = mProfD;
      return copy.forget();
    }

    // Create a unique temporary folder to use for this test.
    // Note that runcppunittests.py will run tests with a temp
    // directory as the cwd, so just put something under that.
    nsCOMPtr profD;
    nsresult rv = NS_GetSpecialDirectory(NS_OS_CURRENT_PROCESS_DIR,
                                         getter_AddRefs(profD));
    NS_ENSURE_SUCCESS(rv, nullptr);

    rv = profD->Append(u"cpp-unit-profd"_ns);
    NS_ENSURE_SUCCESS(rv, nullptr);

    rv = profD->CreateUnique(nsIFile::DIRECTORY_TYPE, 0755);
    NS_ENSURE_SUCCESS(rv, nullptr);

    mProfD = profD;
    return profD.forget();
  }

  already_AddRefed GetGREDirectory() {
    if (mGRED) {
      nsCOMPtr copy = mGRED;
      return copy.forget();
    }

    char* env = PR_GetEnv("MOZ_XRE_DIR");
    nsCOMPtr greD;
    if (env) {
      NS_NewLocalFile(NS_ConvertUTF8toUTF16(env), false, getter_AddRefs(greD));
    }

    mGRED = greD;
    return greD.forget();
  }

  already_AddRefed GetGREBinDirectory() {
    if (mGREBinD) {
      nsCOMPtr copy = mGREBinD;
      return copy.forget();
    }

    nsCOMPtr greD = GetGREDirectory();
    if (!greD) {
      return greD.forget();
    }
    greD->Clone(getter_AddRefs(mGREBinD));

#ifdef XP_MACOSX
    nsAutoCString leafName;
    mGREBinD->GetNativeLeafName(leafName);
    if (leafName.EqualsLiteral("Resources")) {
      mGREBinD->SetNativeLeafName("MacOS"_ns);
    }
#endif

    nsCOMPtr copy = mGREBinD;
    return copy.forget();
  }

  ////////////////////////////////////////////////////////////////////////////
  //// nsIDirectoryServiceProvider

  NS_IMETHODIMP GetFile(const char* aProperty, bool* _persistent,
                        nsIFile** _result) override {
    // If we were supplied a directory service provider, ask it first.
    if (mDirSvcProvider && NS_SUCCEEDED(mDirSvcProvider->GetFile(
                               aProperty, _persistent, _result))) {
      return NS_OK;
    }

    // Otherwise, the test harness provides some directories automatically.
    if (0 == strcmp(aProperty, NS_APP_USER_PROFILE_50_DIR) ||
        0 == strcmp(aProperty, NS_APP_USER_PROFILE_LOCAL_50_DIR) ||
        0 == strcmp(aProperty, NS_APP_PROFILE_LOCAL_DIR_STARTUP)) {
      nsCOMPtr profD = GetProfileDirectory();
      NS_ENSURE_TRUE(profD, NS_ERROR_FAILURE);

      nsCOMPtr clone;
      nsresult rv = profD->Clone(getter_AddRefs(clone));
      NS_ENSURE_SUCCESS(rv, rv);

      *_persistent = true;
      clone.forget(_result);
      return NS_OK;
    } else if (0 == strcmp(aProperty, NS_GRE_DIR)) {
      nsCOMPtr greD = GetGREDirectory();
      NS_ENSURE_TRUE(greD, NS_ERROR_FAILURE);

      *_persistent = true;
      greD.forget(_result);
      return NS_OK;
    } else if (0 == strcmp(aProperty, NS_GRE_BIN_DIR)) {
      nsCOMPtr greBinD = GetGREBinDirectory();
      NS_ENSURE_TRUE(greBinD, NS_ERROR_FAILURE);

      *_persistent = true;
      greBinD.forget(_result);
      return NS_OK;
    }

    return NS_ERROR_FAILURE;
  }

  ////////////////////////////////////////////////////////////////////////////
  //// nsIDirectoryServiceProvider2

  NS_IMETHODIMP GetFiles(const char* aProperty,
                         nsISimpleEnumerator** _enum) override {
    // If we were supplied a directory service provider, ask it first.
    nsCOMPtr provider =
        do_QueryInterface(mDirSvcProvider);
    if (provider && NS_SUCCEEDED(provider->GetFiles(aProperty, _enum))) {
      return NS_OK;
    }

    return NS_ERROR_FAILURE;
  }

 private:
  const char* mTestName;
  nsIServiceManager* mServMgr;
  nsCOMPtr mDirSvcProvider;
  nsCOMPtr mProfD;
  nsCOMPtr mGRED;
  nsCOMPtr mGREBinD;
};

NS_IMPL_QUERY_INTERFACE(ScopedXPCOM, nsIDirectoryServiceProvider,
                        nsIDirectoryServiceProvider2)

NS_IMETHODIMP_(MozExternalRefCountType)
ScopedXPCOM::AddRef() { return 2; }

NS_IMETHODIMP_(MozExternalRefCountType)
ScopedXPCOM::Release() { return 1; }

}  // namespace

Minimal test - lines (59, 247)

path: .spaces[0].spaces[1].metrics.cyclomatic.average
old: 1.0
new: 3.625

path: .spaces[0].spaces[1].metrics.cyclomatic.sum
old: 1.0
new: 29.0

path: .spaces[0].spaces[1].metrics.nom.functions
old: 1.0
new: 7.0

path: .spaces[0].spaces[1].metrics.nom.total
old: 1.0
new: 7.0

path: .spaces[0].spaces[1].metrics.loc.sloc
old: 4.0
new: 189.0

path: .spaces[0].spaces[1].metrics.loc.blank
old: 0.0
new: 31.0

path: .spaces[0].spaces[1].metrics.loc.lloc
old: 1.0
new: 69.0

path: .spaces[0].spaces[1].metrics.loc.cloc
old: 0.0
new: 11.0

path: .spaces[0].spaces[1].metrics.loc.ploc
old: 4.0
new: 147.0

path: .spaces[0].spaces[1].metrics.nargs.sum
old: 2.0
new: 7.0

path: .spaces[0].spaces[1].metrics.nargs.average
old: 2.0
new: 1.0

path: .spaces[0].spaces[1].metrics.nexits.average
old: 0.0
new: 2.142857142857143

path: .spaces[0].spaces[1].metrics.nexits.sum
old: 0.0
new: 15.0

path: .spaces[0].spaces[1].metrics.halstead.volume
old: 140.0
new: 5129.694560090769

path: .spaces[0].spaces[1].metrics.halstead.N1
old: 22.0
new: 409.0

path: .spaces[0].spaces[1].metrics.halstead.n1
old: 7.0
new: 22.0

path: .spaces[0].spaces[1].metrics.halstead.length
old: 35.0
new: 734.0

path: .spaces[0].spaces[1].metrics.halstead.n2
old: 9.0
new: 105.0

path: .spaces[0].spaces[1].metrics.halstead.estimated_program_length
old: 48.18080946738404
new: 803.1032749649635

path: .spaces[0].spaces[1].metrics.halstead.level
old: 0.19780219780219785
new: 0.029370629370629366

path: .spaces[0].spaces[1].metrics.halstead.purity_ratio
old: 1.3765945562109725
new: 1.0941461511784245

path: .spaces[0].spaces[1].metrics.halstead.N2
old: 13.0
new: 325.0

path: .spaces[0].spaces[1].metrics.halstead.effort
old: 707.7777777777777
new: 174653.8862126143

path: .spaces[0].spaces[1].metrics.halstead.time
old: 39.32098765432099
new: 9702.993678478571

path: .spaces[0].spaces[1].metrics.halstead.bugs
old: 0.02647341862482068
new: 1.041511926885946

path: .spaces[0].spaces[1].metrics.halstead.difficulty
old: 5.055555555555555
new: 34.04761904761905

path: .spaces[0].spaces[1].metrics.halstead.vocabulary
old: 16.0
new: 127.0

path: .spaces[0].spaces[1].metrics.cognitive.sum
old: 0.0
new: 23.0

path: .spaces[0].spaces[1].metrics.cognitive.average
old: 0.0
new: 3.2857142857142856

path: .spaces[0].spaces[1].metrics.mi.mi_sei
old: 101.29772831188616
new: -4.0114955221940285

path: .spaces[0].spaces[1].metrics.mi.mi_original
old: 122.61549075228942
new: 34.991131094499394

path: .spaces[0].spaces[1].metrics.mi.mi_visual_studio
old: 71.70496535221604
new: 20.462649762865144

Code

class ScopedXPCOM final : public nsIDirectoryServiceProvider2 {
 public:
  NS_DECL_ISUPPORTS

  explicit ScopedXPCOM(const char* testName,
                       nsIDirectoryServiceProvider* dirSvcProvider = nullptr)
      : mDirSvcProvider(dirSvcProvider) {
    mTestName = testName;
    printf("Running %s tests...\n", mTestName);

    nsresult rv = NS_InitXPCOM(&mServMgr, nullptr, this);
    if (NS_FAILED(rv)) {
      fail("NS_InitXPCOM returned failure code 0x%" PRIx32,
           static_cast(rv));
      mServMgr = nullptr;
      return;
    }
  }

  ~ScopedXPCOM() {
    // If we created a profile directory, we need to remove it.
    if (mProfD) {
      nsCOMPtr os =
          do_GetService(NS_OBSERVERSERVICE_CONTRACTID);
      MOZ_ASSERT(os);
      if (os) {
        MOZ_ALWAYS_SUCCEEDS(os->NotifyObservers(
            nullptr, "profile-change-net-teardown", nullptr));
        MOZ_ALWAYS_SUCCEEDS(
            os->NotifyObservers(nullptr, "profile-change-teardown", nullptr));
        MOZ_ALWAYS_SUCCEEDS(
            os->NotifyObservers(nullptr, "profile-before-change", nullptr));
        MOZ_ALWAYS_SUCCEEDS(
            os->NotifyObservers(nullptr, "profile-before-change-qm", nullptr));
        MOZ_ALWAYS_SUCCEEDS(os->NotifyObservers(
            nullptr, "profile-before-change-telemetry", nullptr));
      }

      if (NS_FAILED(mProfD->Remove(true))) {
        NS_WARNING("Problem removing profile directory");
      }

      mProfD = nullptr;
    }

    if (mServMgr) {
      NS_RELEASE(mServMgr);
      nsresult rv = NS_ShutdownXPCOM(nullptr);
      if (NS_FAILED(rv)) {
        fail("XPCOM shutdown failed with code 0x%" PRIx32,
             static_cast(rv));
        exit(1);
      }
    }

    printf("Finished running %s tests.\n", mTestName);
  }

  already_AddRefed GetProfileDirectory() {
    if (mProfD) {
      nsCOMPtr copy = mProfD;
      return copy.forget();
    }

    // Create a unique temporary folder to use for this test.
    // Note that runcppunittests.py will run tests with a temp
    // directory as the cwd, so just put something under that.
    nsCOMPtr profD;
    nsresult rv = NS_GetSpecialDirectory(NS_OS_CURRENT_PROCESS_DIR,
                                         getter_AddRefs(profD));
    NS_ENSURE_SUCCESS(rv, nullptr);

    rv = profD->Append(u"cpp-unit-profd"_ns);
    NS_ENSURE_SUCCESS(rv, nullptr);

    rv = profD->CreateUnique(nsIFile::DIRECTORY_TYPE, 0755);
    NS_ENSURE_SUCCESS(rv, nullptr);

    mProfD = profD;
    return profD.forget();
  }

  already_AddRefed GetGREDirectory() {
    if (mGRED) {
      nsCOMPtr copy = mGRED;
      return copy.forget();
    }

    char* env = PR_GetEnv("MOZ_XRE_DIR");
    nsCOMPtr greD;
    if (env) {
      NS_NewLocalFile(NS_ConvertUTF8toUTF16(env), false, getter_AddRefs(greD));
    }

    mGRED = greD;
    return greD.forget();
  }

  already_AddRefed GetGREBinDirectory() {
    if (mGREBinD) {
      nsCOMPtr copy = mGREBinD;
      return copy.forget();
    }

    nsCOMPtr greD = GetGREDirectory();
    if (!greD) {
      return greD.forget();
    }
    greD->Clone(getter_AddRefs(mGREBinD));

#ifdef XP_MACOSX
    nsAutoCString leafName;
    mGREBinD->GetNativeLeafName(leafName);
    if (leafName.EqualsLiteral("Resources")) {
      mGREBinD->SetNativeLeafName("MacOS"_ns);
    }
#endif

    nsCOMPtr copy = mGREBinD;
    return copy.forget();
  }

  ////////////////////////////////////////////////////////////////////////////
  //// nsIDirectoryServiceProvider

  NS_IMETHODIMP GetFile(const char* aProperty, bool* _persistent,
                        nsIFile** _result) override {
    // If we were supplied a directory service provider, ask it first.
    if (mDirSvcProvider && NS_SUCCEEDED(mDirSvcProvider->GetFile(
                               aProperty, _persistent, _result))) {
      return NS_OK;
    }

    // Otherwise, the test harness provides some directories automatically.
    if (0 == strcmp(aProperty, NS_APP_USER_PROFILE_50_DIR) ||
        0 == strcmp(aProperty, NS_APP_USER_PROFILE_LOCAL_50_DIR) ||
        0 == strcmp(aProperty, NS_APP_PROFILE_LOCAL_DIR_STARTUP)) {
      nsCOMPtr profD = GetProfileDirectory();
      NS_ENSURE_TRUE(profD, NS_ERROR_FAILURE);

      nsCOMPtr clone;
      nsresult rv = profD->Clone(getter_AddRefs(clone));
      NS_ENSURE_SUCCESS(rv, rv);

      *_persistent = true;
      clone.forget(_result);
      return NS_OK;
    } else if (0 == strcmp(aProperty, NS_GRE_DIR)) {
      nsCOMPtr greD = GetGREDirectory();
      NS_ENSURE_TRUE(greD, NS_ERROR_FAILURE);

      *_persistent = true;
      greD.forget(_result);
      return NS_OK;
    } else if (0 == strcmp(aProperty, NS_GRE_BIN_DIR)) {
      nsCOMPtr greBinD = GetGREBinDirectory();
      NS_ENSURE_TRUE(greBinD, NS_ERROR_FAILURE);

      *_persistent = true;
      greBinD.forget(_result);
      return NS_OK;
    }

    return NS_ERROR_FAILURE;
  }

  ////////////////////////////////////////////////////////////////////////////
  //// nsIDirectoryServiceProvider2

  NS_IMETHODIMP GetFiles(const char* aProperty,
                         nsISimpleEnumerator** _enum) override {
    // If we were supplied a directory service provider, ask it first.
    nsCOMPtr provider =
        do_QueryInterface(mDirSvcProvider);
    if (provider && NS_SUCCEEDED(provider->GetFiles(aProperty, _enum))) {
      return NS_OK;
    }

    return NS_ERROR_FAILURE;
  }

 private:
  const char* mTestName;
  nsIServiceManager* mServMgr;
  nsCOMPtr mDirSvcProvider;
  nsCOMPtr mProfD;
  nsCOMPtr mGRED;
  nsCOMPtr mGREBinD;
};

Minimal test - lines (44, 55)

path: .spaces[0].spaces[0].metrics.nargs.sum
old: 6.0
new: 2.0

path: .spaces[0].spaces[0].metrics.mi.mi_sei
old: -1.5819798676366776
new: 74.55323684761127

path: .spaces[0].spaces[0].metrics.mi.mi_visual_studio
old: 25.2919679892827
new: 60.86410637328522

path: .spaces[0].spaces[0].metrics.mi.mi_original
old: 43.249265261673415
new: 104.07762189831772

path: .spaces[0].spaces[0].metrics.cyclomatic.average
old: 5.25
new: 1.0

path: .spaces[0].spaces[0].metrics.cyclomatic.sum
old: 21.0
new: 1.0

path: .spaces[0].spaces[0].metrics.halstead.length
old: 701.0
new: 38.0

path: .spaces[0].spaces[0].metrics.halstead.N2
old: 283.0
new: 17.0

path: .spaces[0].spaces[0].metrics.halstead.N1
old: 418.0
new: 21.0

path: .spaces[0].spaces[0].metrics.halstead.vocabulary
old: 128.0
new: 19.0

path: .spaces[0].spaces[0].metrics.halstead.time
old: 10311.987623762376
new: 44.46557457359234

path: .spaces[0].spaces[0].metrics.halstead.n1
old: 27.0
new: 7.0

path: .spaces[0].spaces[0].metrics.halstead.purity_ratio
old: 1.1424555239890797
new: 1.6492377490278185

path: .spaces[0].spaces[0].metrics.halstead.estimated_program_length
old: 800.8613223163449
new: 62.6710344630571

path: .spaces[0].spaces[0].metrics.halstead.n2
old: 101.0
new: 12.0

path: .spaces[0].spaces[0].metrics.halstead.bugs
old: 1.0846476278010917
new: 0.02873489984245458

path: .spaces[0].spaces[0].metrics.halstead.difficulty
old: 37.82673267326733
new: 4.958333333333333

path: .spaces[0].spaces[0].metrics.halstead.volume
old: 4907.0
new: 161.42124551085624

path: .spaces[0].spaces[0].metrics.halstead.effort
old: 185615.7772277228
new: 800.3803423246621

path: .spaces[0].spaces[0].metrics.halstead.level
old: 0.026436330323256117
new: 0.20168067226890757

path: .spaces[0].spaces[0].metrics.cognitive.sum
old: 9.0
new: 0.0

path: .spaces[0].spaces[0].metrics.cognitive.average
old: 3.0
new: 0.0

path: .spaces[0].spaces[0].metrics.nom.functions
old: 3.0
new: 1.0

path: .spaces[0].spaces[0].metrics.nom.total
old: 3.0
new: 1.0

path: .spaces[0].spaces[0].metrics.loc.blank
old: 8.0
new: 3.0

path: .spaces[0].spaces[0].metrics.loc.lloc
old: 59.0
new: 6.0

path: .spaces[0].spaces[0].metrics.loc.sloc
old: 129.0
new: 12.0

path: .spaces[0].spaces[0].metrics.loc.cloc
old: 2.0
new: 0.0

path: .spaces[0].spaces[0].metrics.loc.ploc
old: 119.0
new: 9.0

path: .spaces[0].spaces[0].metrics.nexits.average
old: 2.6666666666666665
new: 0.0

path: .spaces[0].spaces[0].metrics.nexits.sum
old: 8.0
new: 0.0

Code

MOZ_FORMAT_PRINTF(1, 2) void fail(const char* msg, ...) {
  va_list ap;

  printf("TEST-UNEXPECTED-FAIL | ");

  va_start(ap, msg);
  vprintf(msg, ap);
  va_end(ap);

  putchar('\n');
  ++gFailCount;
}