Global Metrics
path: .metrics.halstead.bugs
old: 0.30566237475747
new: 4.7449902865353
path: .metrics.halstead.vocabulary
old: 61.0
new: 122.0
path: .metrics.halstead.n2
old: 39.0
new: 100.0
path: .metrics.halstead.volume
old: 1186.1474675125774
new: 15933.765139057075
path: .metrics.halstead.N1
old: 117.0
new: 1330.0
path: .metrics.halstead.level
old: 0.04271631982475356
new: 0.009381743127873158
path: .metrics.halstead.estimated_program_length
old: 304.23818214564824
new: 762.493114587493
path: .metrics.halstead.length
old: 200.0
new: 2299.0
path: .metrics.halstead.N2
old: 83.0
new: 969.0
path: .metrics.halstead.difficulty
old: 23.41025641025641
new: 106.59
path: .metrics.halstead.time
old: 1542.6675752692067
new: 94354.44589844966
path: .metrics.halstead.effort
old: 27768.01635484572
new: 1698380.0261720938
path: .metrics.halstead.purity_ratio
old: 1.521190910728241
new: 0.3316629467540204
path: .metrics.cognitive.sum
old: 22.0
new: 7.0
path: .metrics.cognitive.average
old: 7.333333333333333
new: 0.25
path: .metrics.loc.ploc
old: 41.0
new: 431.0
path: .metrics.loc.sloc
old: 69.0
new: 573.0
path: .metrics.loc.blank
old: 10.0
new: 104.0
path: .metrics.loc.cloc
old: 18.0
new: 38.0
path: .metrics.loc.lloc
old: 17.0
new: 185.0
path: .metrics.nargs.sum
old: 1.0
new: 48.0
path: .metrics.nargs.average
old: 0.3333333333333333
new: 1.7142857142857142
path: .metrics.mi.mi_original
old: 61.68945188282336
new: 5.379433592067542
path: .metrics.mi.mi_visual_studio
old: 36.075702855452256
new: 3.1458675977003168
path: .metrics.mi.mi_sei
old: 50.59100897074064
new: -43.01907737010523
path: .metrics.cyclomatic.average
old: 3.4
new: 2.16
path: .metrics.cyclomatic.sum
old: 17.0
new: 54.0
path: .metrics.nexits.sum
old: 2.0
new: 4.0
path: .metrics.nexits.average
old: 0.6666666666666666
new: 0.14285714285714285
path: .metrics.nom.closures
old: 0.0
new: 4.0
path: .metrics.nom.functions
old: 3.0
new: 24.0
path: .metrics.nom.total
old: 3.0
new: 28.0
Spaces Data
Minimal test - lines (34, 158)
path: .spaces[0].metrics.loc.cloc
old: 3.0
new: 31.0
path: .spaces[0].metrics.loc.lloc
old: 0.0
new: 37.0
path: .spaces[0].metrics.loc.ploc
old: 6.0
new: 80.0
path: .spaces[0].metrics.loc.sloc
old: 10.0
new: 125.0
path: .spaces[0].metrics.loc.blank
old: 1.0
new: 14.0
path: .spaces[0].metrics.cyclomatic.sum
old: 2.0
new: 1.0
path: .spaces[0].metrics.nargs.average
old: 0.0
new: 2.0
path: .spaces[0].metrics.nargs.sum
old: 0.0
new: 2.0
path: .spaces[0].metrics.mi.mi_sei
old: 125.78679535029757
new: 30.736387781249192
path: .spaces[0].metrics.mi.mi_visual_studio
old: 66.38347494149352
new: 28.97239221031045
path: .spaces[0].metrics.mi.mi_original
old: 113.51574214995392
new: 49.54279067963087
path: .spaces[0].metrics.halstead.difficulty
old: 4.0
new: 28.0531914893617
path: .spaces[0].metrics.halstead.vocabulary
old: 9.0
new: 56.0
path: .spaces[0].metrics.halstead.N2
old: 4.0
new: 293.0
path: .spaces[0].metrics.halstead.time
old: 9.861988893376084
new: 6091.204838966047
path: .spaces[0].metrics.halstead.purity_ratio
old: 1.447475893320743
new: 0.43030460778875146
path: .spaces[0].metrics.halstead.n2
old: 3.0
new: 47.0
path: .spaces[0].metrics.halstead.N1
old: 10.0
new: 380.0
path: .spaces[0].metrics.halstead.estimated_program_length
old: 20.264662506490403
new: 289.59500104182973
path: .spaces[0].metrics.halstead.bugs
old: 0.0105285869496718
new: 0.7635940781337625
path: .spaces[0].metrics.halstead.effort
old: 177.51580008076948
new: 109641.68710138884
path: .spaces[0].metrics.halstead.volume
old: 44.37895002019237
new: 3908.3498625447673
path: .spaces[0].metrics.halstead.length
old: 14.0
new: 673.0
path: .spaces[0].metrics.halstead.level
old: 0.25
new: 0.035646568069776265
path: .spaces[0].metrics.halstead.n1
old: 6.0
new: 9.0
Code
TEST(ObserverArray, Tests)
{
IntArray arr;
arr.AppendElement(3);
arr.AppendElement(4);
size_t count;
int testNum = 0;
// Basic sanity
static int test1Expected[] = {3, 4};
DO_TEST(ForwardIterator, test1Expected, {/* nothing */});
// Appends
static int test2Expected[] = {3, 4, 2};
DO_TEST(ForwardIterator, test2Expected,
if (count == 1) arr.AppendElement(2););
DO_TEST(ForwardIterator, test2Expected, {/* nothing */});
DO_TEST(EndLimitedIterator, test2Expected,
if (count == 1) arr.AppendElement(5););
static int test5Expected[] = {3, 4, 2, 5};
DO_TEST(ForwardIterator, test5Expected, {/* nothing */});
// Removals
DO_TEST(ForwardIterator, test5Expected,
if (count == 1) arr.RemoveElementAt(0););
static int test7Expected[] = {4, 2, 5};
DO_TEST(ForwardIterator, test7Expected, {/* nothing */});
static int test8Expected[] = {4, 5};
DO_TEST(ForwardIterator, test8Expected,
if (count == 1) arr.RemoveElementAt(1););
DO_TEST(ForwardIterator, test8Expected, {/* nothing */});
arr.AppendElement(2);
arr.AppendElementUnlessExists(6);
static int test10Expected[] = {4, 5, 2, 6};
DO_TEST(ForwardIterator, test10Expected, {/* nothing */});
arr.AppendElementUnlessExists(5);
DO_TEST(ForwardIterator, test10Expected, {/* nothing */});
static int test12Expected[] = {4, 5, 6};
DO_TEST(ForwardIterator, test12Expected,
if (count == 1) arr.RemoveElementAt(2););
DO_TEST(ForwardIterator, test12Expected, {/* nothing */});
// Removals + Appends
static int test14Expected[] = {4, 6, 7};
DO_TEST(
ForwardIterator, test14Expected, if (count == 1) {
arr.RemoveElementAt(1);
arr.AppendElement(7);
});
DO_TEST(ForwardIterator, test14Expected, {/* nothing */});
arr.AppendElement(2);
static int test16Expected[] = {4, 6, 7, 2};
DO_TEST(ForwardIterator, test16Expected, {/* nothing */});
static int test17Expected[] = {4, 7, 2};
DO_TEST(
EndLimitedIterator, test17Expected, if (count == 1) {
arr.RemoveElementAt(1);
arr.AppendElement(8);
});
static int test18Expected[] = {4, 7, 2, 8};
DO_TEST(ForwardIterator, test18Expected, {/* nothing */});
// Prepends
arr.PrependElementUnlessExists(3);
static int test19Expected[] = {3, 4, 7, 2, 8};
DO_TEST(ForwardIterator, test19Expected, {/* nothing */});
arr.PrependElementUnlessExists(7);
DO_TEST(ForwardIterator, test19Expected, {/* nothing */});
DO_TEST(
ForwardIterator, test19Expected,
if (count == 1) { arr.PrependElementUnlessExists(9); });
static int test22Expected[] = {9, 3, 4, 7, 2, 8};
DO_TEST(ForwardIterator, test22Expected, {});
// BackwardIterator
static int test23Expected[] = {8, 2, 7, 4, 3, 9};
DO_TEST(BackwardIterator, test23Expected, );
// Removals
static int test24Expected[] = {8, 2, 7, 4, 9};
DO_TEST(BackwardIterator, test24Expected,
if (count == 1) arr.RemoveElementAt(1););
// Appends
DO_TEST(BackwardIterator, test24Expected,
if (count == 1) arr.AppendElement(1););
static int test26Expected[] = {1, 8, 2, 7, 4, 9};
DO_TEST(BackwardIterator, test26Expected, );
// Prepends
static int test27Expected[] = {1, 8, 2, 7, 4, 9, 3};
DO_TEST(BackwardIterator, test27Expected,
if (count == 1) arr.PrependElementUnlessExists(3););
// Removal using Iterator
DO_TEST(BackwardIterator, test27Expected,
// when this code runs, |GetNext()| has only been called once, so
// this actually removes the very first element
if (count == 1) iter.Remove(););
static int test28Expected[] = {8, 2, 7, 4, 9, 3};
DO_TEST(BackwardIterator, test28Expected, );
/**
* Note: _code is executed before the call to GetNext(), it can therefore not
* test the case of prepending when the BackwardIterator already returned the
* first element.
* In that case BackwardIterator does not traverse the newly prepended Element
*/
}
Minimal test - lines (178, 193)
path: .spaces[2].metrics.nargs.sum
old: 1.0
new: 2.0
path: .spaces[2].metrics.nargs.average
old: 1.0
new: 2.0
path: .spaces[2].metrics.cognitive.sum
old: 1.0
new: 0.0
path: .spaces[2].metrics.cognitive.average
old: 1.0
new: 0.0
path: .spaces[2].metrics.mi.mi_original
old: 103.49109068311952
new: 96.22577118445496
path: .spaces[2].metrics.mi.mi_visual_studio
old: 60.521105662643
new: 56.27238080962278
path: .spaces[2].metrics.mi.mi_sei
old: 95.43161297921624
new: 63.327230620325466
path: .spaces[2].metrics.halstead.N2
old: 16.0
new: 27.0
path: .spaces[2].metrics.halstead.n1
old: 10.0
new: 11.0
path: .spaces[2].metrics.halstead.time
old: 76.834277242442
new: 147.10433209818228
path: .spaces[2].metrics.halstead.n2
old: 10.0
new: 16.0
path: .spaces[2].metrics.halstead.vocabulary
old: 20.0
new: 27.0
path: .spaces[2].metrics.halstead.length
old: 40.0
new: 60.0
path: .spaces[2].metrics.halstead.estimated_program_length
old: 66.43856189774725
new: 102.05374780501026
path: .spaces[2].metrics.halstead.purity_ratio
old: 1.660964047443681
new: 1.700895796750171
path: .spaces[2].metrics.halstead.difficulty
old: 8.0
new: 9.28125
path: .spaces[2].metrics.halstead.N1
old: 24.0
new: 33.0
path: .spaces[2].metrics.halstead.effort
old: 1383.016990363956
new: 2647.877977767281
path: .spaces[2].metrics.halstead.volume
old: 172.8771237954945
new: 285.2932501298081
path: .spaces[2].metrics.halstead.level
old: 0.125
new: 0.10774410774410774
path: .spaces[2].metrics.halstead.bugs
old: 0.04137745314661115
new: 0.06379853757458535
path: .spaces[2].metrics.nexits.sum
old: 2.0
new: 0.0
path: .spaces[2].metrics.nexits.average
old: 2.0
new: 0.0
path: .spaces[2].metrics.loc.cloc
old: 1.0
new: 0.0
path: .spaces[2].metrics.loc.ploc
old: 8.0
new: 14.0
path: .spaces[2].metrics.loc.sloc
old: 12.0
new: 16.0
path: .spaces[2].metrics.loc.blank
old: 3.0
new: 2.0
Code
TEST(ObserverArray, RangeBasedFor_Value_Forward_NonEmpty)
{
IntArray arr;
arr.AppendElement(3);
arr.AppendElement(4);
size_t iterations = 0;
int sum = 0;
for (int element : arr.ForwardRange()) {
sum += element;
++iterations;
}
EXPECT_EQ(2u, iterations);
EXPECT_EQ(7, sum);
}
Minimal test - lines (160, 176)
path: .spaces[1].metrics.cyclomatic.average
old: 12.0
new: 2.0
path: .spaces[1].metrics.cyclomatic.sum
old: 12.0
new: 2.0
path: .spaces[1].metrics.halstead.N2
old: 59.0
new: 33.0
path: .spaces[1].metrics.halstead.time
old: 732.6521010628269
new: 203.11944491821575
path: .spaces[1].metrics.halstead.effort
old: 13187.737819130884
new: 3656.150008527884
path: .spaces[1].metrics.halstead.N1
old: 81.0
new: 45.0
path: .spaces[1].metrics.halstead.estimated_program_length
old: 174.6997636784959
new: 118.76437056043838
path: .spaces[1].metrics.halstead.level
old: 0.05649717514124294
new: 0.1046831955922865
path: .spaces[1].metrics.halstead.n1
old: 15.0
new: 11.0
path: .spaces[1].metrics.halstead.volume
old: 745.0699332842307
new: 382.7374664574645
path: .spaces[1].metrics.halstead.bugs
old: 0.18606254125227265
new: 0.07910939855317138
path: .spaces[1].metrics.halstead.n2
old: 25.0
new: 19.0
path: .spaces[1].metrics.halstead.difficulty
old: 17.7
new: 9.552631578947368
path: .spaces[1].metrics.halstead.purity_ratio
old: 1.2478554548463994
new: 1.5226201353902356
path: .spaces[1].metrics.halstead.vocabulary
old: 40.0
new: 30.0
path: .spaces[1].metrics.halstead.length
old: 140.0
new: 78.0
path: .spaces[1].metrics.nargs.average
old: 0.0
new: 2.0
path: .spaces[1].metrics.nargs.sum
old: 0.0
new: 2.0
path: .spaces[1].metrics.mi.mi_original
old: 79.86820089755984
new: 93.71572752883074
path: .spaces[1].metrics.mi.mi_sei
old: 71.19067123422053
new: 59.70600308594163
path: .spaces[1].metrics.mi.mi_visual_studio
old: 46.70655023249114
new: 54.804519022708035
path: .spaces[1].metrics.loc.cloc
old: 5.0
new: 0.0
path: .spaces[1].metrics.loc.ploc
old: 23.0
new: 14.0
path: .spaces[1].metrics.loc.blank
old: 0.0
new: 3.0
path: .spaces[1].metrics.loc.sloc
old: 28.0
new: 17.0
path: .spaces[1].metrics.loc.lloc
old: 11.0
new: 6.0
path: .spaces[1].metrics.cognitive.sum
old: 21.0
new: 1.0
path: .spaces[1].metrics.cognitive.average
old: 21.0
new: 1.0
Code
TEST(ObserverArray, ForwardIterator_Remove)
{
static const int expected[] = {3, 4};
IntArray arr;
arr.AppendElement(3);
arr.AppendElement(4);
size_t count = 0;
for (auto iter = IntArray::ForwardIterator{arr}; iter.HasMore();) {
const int next = iter.GetNext();
iter.Remove();
ASSERT_EQ(expected[count++], next);
}
ASSERT_EQ(2u, count);
}