Global Metrics
path: .metrics.cognitive.sum
old: 1.0
new: 0.0
path: .metrics.cognitive.average
old: 0.5
new: 0.0
path: .metrics.cyclomatic.sum
old: 6.0
new: 20.0
path: .metrics.cyclomatic.average
old: 1.2
new: 1.0
path: .metrics.halstead.effort
old: 963.8904003901164
new: 249982.31781798633
path: .metrics.halstead.length
old: 41.0
new: 789.0
path: .metrics.halstead.N2
old: 18.0
new: 368.0
path: .metrics.halstead.time
old: 53.54946668833979
new: 13887.906545443686
path: .metrics.halstead.N1
old: 23.0
new: 421.0
path: .metrics.halstead.volume
old: 190.3981037807637
new: 5057.009448612646
path: .metrics.halstead.n2
old: 16.0
new: 67.0
path: .metrics.halstead.level
old: 0.19753086419753085
new: 0.020229468599033816
path: .metrics.halstead.bugs
old: 0.032525989338936
new: 1.3227718343174604
path: .metrics.halstead.difficulty
old: 5.0625
new: 49.43283582089552
path: .metrics.halstead.estimated_program_length
old: 92.5293250129808
new: 481.4866257866323
path: .metrics.halstead.purity_ratio
old: 2.2568128051946537
new: 0.6102492088550473
path: .metrics.halstead.vocabulary
old: 25.0
new: 85.0
path: .metrics.halstead.n1
old: 9.0
new: 18.0
path: .metrics.loc.cloc
old: 16.0
new: 65.0
path: .metrics.loc.sloc
old: 37.0
new: 265.0
path: .metrics.loc.lloc
old: 5.0
new: 47.0
path: .metrics.loc.blank
old: 1.0
new: 51.0
path: .metrics.loc.ploc
old: 20.0
new: 149.0
path: .metrics.nexits.sum
old: 1.0
new: 4.0
path: .metrics.nexits.average
old: 0.5
new: 0.26666666666666666
path: .metrics.nargs.average
old: 0.5
new: 0.9333333333333332
path: .metrics.nargs.sum
old: 1.0
new: 14.0
path: .metrics.nom.total
old: 2.0
new: 15.0
path: .metrics.nom.functions
old: 2.0
new: 15.0
path: .metrics.mi.mi_sei
old: 88.42038473293181
new: 6.7193704208199705
path: .metrics.mi.mi_original
old: 83.82772056666383
new: 31.66001785761931
path: .metrics.mi.mi_visual_studio
old: 49.02205881091452
new: 18.51463032609316
Spaces Data
Minimal test - lines (23, 23)
path: .spaces[0].spaces[0].spaces[0].metrics.mi.mi_original
old: 105.25740298808512
new: 155.7127700178179
path: .spaces[0].spaces[0].spaces[0].metrics.mi.mi_sei
old: 118.80963679844396
new: 149.04700897518126
path: .spaces[0].spaces[0].spaces[0].metrics.mi.mi_visual_studio
old: 61.5540368351375
new: 91.0600994256245
path: .spaces[0].spaces[0].spaces[0].metrics.cognitive.sum
old: 1.0
new: 0.0
path: .spaces[0].spaces[0].spaces[0].metrics.cognitive.average
old: 1.0
new: 0.0
path: .spaces[0].spaces[0].spaces[0].metrics.cyclomatic.sum
old: 2.0
new: 1.0
path: .spaces[0].spaces[0].spaces[0].metrics.cyclomatic.average
old: 2.0
new: 1.0
path: .spaces[0].spaces[0].spaces[0].metrics.loc.blank
old: 1.0
new: 0.0
path: .spaces[0].spaces[0].spaces[0].metrics.loc.ploc
old: 7.0
new: 1.0
path: .spaces[0].spaces[0].spaces[0].metrics.loc.lloc
old: 4.0
new: 0.0
path: .spaces[0].spaces[0].spaces[0].metrics.loc.sloc
old: 14.0
new: 1.0
path: .spaces[0].spaces[0].spaces[0].metrics.loc.cloc
old: 6.0
new: 0.0
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.N1
old: 15.0
new: 4.0
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.estimated_program_length
old: 40.13896548741762
new: 9.509775004326936
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.length
old: 20.0
new: 7.0
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.effort
old: 342.6619429851844
new: 27.14210625757214
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.n2
old: 5.0
new: 3.0
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.n1
old: 9.0
new: 3.0
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.level
old: 0.2222222222222222
new: 0.6666666666666666
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.bugs
old: 0.01632259960095138
new: 0.003010517177243676
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.vocabulary
old: 14.0
new: 6.0
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.N2
old: 5.0
new: 3.0
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.purity_ratio
old: 2.006948274370881
new: 1.3585392863324195
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.volume
old: 76.14709844115208
new: 18.094737505048094
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.difficulty
old: 4.5
new: 1.5
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.time
old: 19.03677461028802
new: 1.5078947920873411
path: .spaces[0].spaces[0].spaces[0].metrics.nexits.sum
old: 1.0
new: 0.0
path: .spaces[0].spaces[0].spaces[0].metrics.nexits.average
old: 1.0
new: 0.0
Code
MockCurrentTimeGetter() : mTime(0) {}
Minimal test - lines (21, 32)
path: .spaces[0].spaces[0].metrics.cyclomatic.sum
old: 4.0
new: 5.0
path: .spaces[0].spaces[0].metrics.cyclomatic.average
old: 1.3333333333333333
new: 1.0
path: .spaces[0].spaces[0].metrics.nargs.sum
old: 1.0
new: 2.0
path: .spaces[0].spaces[0].metrics.halstead.n1
old: 9.0
new: 7.0
path: .spaces[0].spaces[0].metrics.halstead.bugs
old: 0.027683138627893834
new: 0.03285258339450886
path: .spaces[0].spaces[0].metrics.halstead.purity_ratio
old: 1.7290500007867158
new: 1.302184039659028
path: .spaces[0].spaces[0].metrics.halstead.difficulty
old: 5.5
new: 6.611111111111111
path: .spaces[0].spaces[0].metrics.halstead.estimated_program_length
old: 57.05865002596162
new: 48.18080946738404
path: .spaces[0].spaces[0].metrics.halstead.vocabulary
old: 18.0
new: 16.0
path: .spaces[0].spaces[0].metrics.halstead.length
old: 33.0
new: 37.0
path: .spaces[0].spaces[0].metrics.halstead.time
old: 42.04674376454332
new: 54.35802469135802
path: .spaces[0].spaces[0].metrics.halstead.volume
old: 137.6075250475963
new: 148.0
path: .spaces[0].spaces[0].metrics.halstead.N2
old: 11.0
new: 17.0
path: .spaces[0].spaces[0].metrics.halstead.N1
old: 22.0
new: 20.0
path: .spaces[0].spaces[0].metrics.halstead.level
old: 0.18181818181818185
new: 0.1512605042016807
path: .spaces[0].spaces[0].metrics.halstead.effort
old: 756.8413877617797
new: 978.4444444444443
path: .spaces[0].spaces[0].metrics.mi.mi_sei
old: 97.07548730487515
new: 95.90719193474024
path: .spaces[0].spaces[0].metrics.mi.mi_visual_studio
old: 55.203627528641064
new: 60.59006342097134
path: .spaces[0].spaces[0].metrics.mi.mi_original
old: 94.39820307397622
new: 103.609008449861
path: .spaces[0].spaces[0].metrics.loc.blank
old: 4.0
new: 2.0
path: .spaces[0].spaces[0].metrics.loc.cloc
old: 6.0
new: 1.0
path: .spaces[0].spaces[0].metrics.loc.ploc
old: 12.0
new: 9.0
path: .spaces[0].spaces[0].metrics.loc.lloc
old: 5.0
new: 1.0
path: .spaces[0].spaces[0].metrics.loc.sloc
old: 22.0
new: 12.0
path: .spaces[0].spaces[0].metrics.nexits.average
old: 0.5
new: 0.25
path: .spaces[0].spaces[0].metrics.nom.functions
old: 2.0
new: 4.0
path: .spaces[0].spaces[0].metrics.nom.total
old: 2.0
new: 4.0
path: .spaces[0].spaces[0].metrics.cognitive.sum
old: 1.0
new: 0.0
path: .spaces[0].spaces[0].metrics.cognitive.average
old: 0.5
new: 0.0
Code
class MockCurrentTimeGetter {
public:
MockCurrentTimeGetter() : mTime(0) {}
explicit MockCurrentTimeGetter(Time aTime) : mTime(aTime) {}
// Methods needed for CurrentTimeGetter compatibility
Time GetCurrentTime() const { return mTime; }
void GetTimeAsyncForPossibleBackwardsSkew(const TimeStamp& aNow) {}
private:
Time mTime;
};
Minimal test - lines (15, 95)
path: .spaces[0].metrics.nexits.sum
old: 1.0
new: 4.0
path: .spaces[0].metrics.nexits.average
old: 0.5
new: 0.4
path: .spaces[0].metrics.cyclomatic.sum
old: 5.0
new: 14.0
path: .spaces[0].metrics.cyclomatic.average
old: 1.25
new: 1.0
path: .spaces[0].metrics.halstead.n2
old: 10.0
new: 24.0
path: .spaces[0].metrics.halstead.length
old: 35.0
new: 144.0
path: .spaces[0].metrics.halstead.bugs
old: 0.028794177640427535
new: 0.17655665274402377
path: .spaces[0].metrics.halstead.purity_ratio
old: 1.7642458846244125
new: 1.0982278913412635
path: .spaces[0].metrics.halstead.volume
old: 148.67746297052548
new: 750.1612846505689
path: .spaces[0].metrics.halstead.N2
old: 12.0
new: 60.0
path: .spaces[0].metrics.halstead.vocabulary
old: 19.0
new: 37.0
path: .spaces[0].metrics.halstead.difficulty
old: 5.4
new: 16.25
path: .spaces[0].metrics.halstead.N1
old: 23.0
new: 84.0
path: .spaces[0].metrics.halstead.effort
old: 802.8583000408377
new: 12190.120875571743
path: .spaces[0].metrics.halstead.time
old: 44.603238891157645
new: 677.2289375317636
path: .spaces[0].metrics.halstead.estimated_program_length
old: 61.74860596185444
new: 158.14481635314195
path: .spaces[0].metrics.halstead.level
old: 0.18518518518518515
new: 0.06153846153846154
path: .spaces[0].metrics.halstead.n1
old: 9.0
new: 13.0
path: .spaces[0].metrics.nargs.sum
old: 1.0
new: 4.0
path: .spaces[0].metrics.nargs.average
old: 0.5
new: 0.4
path: .spaces[0].metrics.cognitive.sum
old: 1.0
new: 0.0
path: .spaces[0].metrics.cognitive.average
old: 0.5
new: 0.0
path: .spaces[0].metrics.loc.cloc
old: 7.0
new: 26.0
path: .spaces[0].metrics.loc.sloc
old: 24.0
new: 81.0
path: .spaces[0].metrics.loc.lloc
old: 5.0
new: 9.0
path: .spaces[0].metrics.loc.ploc
old: 14.0
new: 42.0
path: .spaces[0].metrics.loc.blank
old: 3.0
new: 13.0
path: .spaces[0].metrics.mi.mi_sei
old: 95.17067135877048
new: 53.87274130533392
path: .spaces[0].metrics.mi.mi_visual_studio
old: 54.00951794390576
new: 36.353464853990715
path: .spaces[0].metrics.mi.mi_original
old: 92.35627568407884
new: 62.16442490032412
path: .spaces[0].metrics.nom.total
old: 2.0
new: 10.0
path: .spaces[0].metrics.nom.functions
old: 2.0
new: 10.0
Code
namespace {
// This class provides a mock implementation of the CurrentTimeGetter template
// type used in SystemTimeConverter. It can be constructed with a particular
// Time and always returns that Time.
template
class MockCurrentTimeGetter {
public:
MockCurrentTimeGetter() : mTime(0) {}
explicit MockCurrentTimeGetter(Time aTime) : mTime(aTime) {}
// Methods needed for CurrentTimeGetter compatibility
Time GetCurrentTime() const { return mTime; }
void GetTimeAsyncForPossibleBackwardsSkew(const TimeStamp& aNow) {}
private:
Time mTime;
};
// This is another mock implementation of the CurrentTimeGetter template
// type used in SystemTimeConverter, except this asserts that it will not be
// used. i.e. it should only be used in calls to SystemTimeConverter that we
// know will not invoke it.
template
class UnusedCurrentTimeGetter {
public:
Time GetCurrentTime() const {
EXPECT_TRUE(false);
return 0;
}
void GetTimeAsyncForPossibleBackwardsSkew(const TimeStamp& aNow) {
EXPECT_TRUE(false);
}
};
// This class provides a mock implementation of the TimeStampNowProvider
// template type used in SystemTimeConverter. It also has other things in it
// that allow the test to better control time for testing purposes.
class MockTimeStamp {
public:
// This should generally be called at the start of every test function, as
// it will initialize this class's static fields to sane values. In particular
// it will initialize the baseline TimeStamp against which all other
// TimeStamps are compared.
static void Init() {
sBaseline = TimeStamp::Now();
sTimeStamp = sBaseline;
}
// Advance the timestamp returned by `MockTimeStamp::Now()`
static void Advance(double ms) {
sTimeStamp += TimeDuration::FromMilliseconds(ms);
}
// Returns the baseline TimeStamp, that is used as a fixed reference point
// in time against which other TimeStamps can be compared. This is needed
// because mozilla::TimeStamp itself doesn't provide any conversion to
// human-readable strings, and we need to convert it to a TimeDuration in
// order to get that. This baseline TimeStamp can be used to turn an
// arbitrary TimeStamp into a TimeDuration.
static TimeStamp Baseline() { return sBaseline; }
// This is the method needed for TimeStampNowProvider compatibility, and
// simulates `TimeStamp::Now()`
static TimeStamp Now() { return sTimeStamp; }
private:
static TimeStamp sTimeStamp;
static TimeStamp sBaseline;
};
TimeStamp MockTimeStamp::sTimeStamp;
TimeStamp MockTimeStamp::sBaseline;
// Could have platform-specific implementations of this using DWORD, guint32,
// etc behind ifdefs. But this is sufficient for now.
using GTestTime = uint32_t;
using TimeConverter = SystemTimeConverter;
} // namespace
Minimal test - lines (24, 24)
path: .spaces[0].spaces[0].spaces[1].metrics.loc.sloc
old: 3.0
new: 1.0
path: .spaces[0].spaces[0].spaces[1].metrics.loc.ploc
old: 3.0
new: 1.0
path: .spaces[0].spaces[0].spaces[1].metrics.loc.lloc
old: 1.0
new: 0.0
path: .spaces[0].spaces[0].spaces[1].metrics.mi.mi_sei
old: 117.79378094715908
new: 146.54249035246173
path: .spaces[0].spaces[0].spaces[1].metrics.mi.mi_visual_studio
old: 78.39162755953055
new: 90.04489473439764
path: .spaces[0].spaces[0].spaces[1].metrics.mi.mi_original
old: 134.04968312679725
new: 153.97676999581998
path: .spaces[0].spaces[0].spaces[1].metrics.halstead.vocabulary
old: 11.0
new: 7.0
path: .spaces[0].spaces[0].spaces[1].metrics.halstead.n1
old: 6.0
new: 3.0
path: .spaces[0].spaces[0].spaces[1].metrics.halstead.effort
old: 114.1612434150308
new: 47.374114309722074
path: .spaces[0].spaces[0].spaces[1].metrics.halstead.volume
old: 38.05374780501027
new: 25.26619429851844
path: .spaces[0].spaces[0].spaces[1].metrics.halstead.bugs
old: 0.007844366425165714
new: 0.00436421510092632
path: .spaces[0].spaces[0].spaces[1].metrics.halstead.level
old: 0.3333333333333333
new: 0.5333333333333333
path: .spaces[0].spaces[0].spaces[1].metrics.halstead.n2
old: 5.0
new: 4.0
path: .spaces[0].spaces[0].spaces[1].metrics.halstead.length
old: 11.0
new: 9.0
path: .spaces[0].spaces[0].spaces[1].metrics.halstead.purity_ratio
old: 2.465401407160341
new: 1.4172097224626077
path: .spaces[0].spaces[0].spaces[1].metrics.halstead.time
old: 6.342291300835045
new: 2.6318952394290043
path: .spaces[0].spaces[0].spaces[1].metrics.halstead.estimated_program_length
old: 27.11941547876375
new: 12.754887502163468
path: .spaces[0].spaces[0].spaces[1].metrics.halstead.difficulty
old: 3.0
new: 1.875
path: .spaces[0].spaces[0].spaces[1].metrics.halstead.N1
old: 6.0
new: 4.0
Code
explicit MockCurrentTimeGetter(Time aTime) : mTime(aTime) {}