Exemplo n.º 1
0
    def test_values(self):
        self.assertEqual(
            ReportFormatter.values(
                PerformanceTestResult(
                    "1,AngryPhonebook,20,10664,12933,11035,576,10884".split(
                        ","))),
            ("AngryPhonebook", "10664", "12933", "11035", "—"),
        )
        self.assertEqual(
            ReportFormatter.values(
                PerformanceTestResult(
                    "1,AngryPhonebook,1,12045,12045,12045,0,12045,10510336".
                    split(","))),
            ("AngryPhonebook", "12045", "12045", "12045", "10510336"),
        )

        r1 = PerformanceTestResult(
            "1,AngryPhonebook,1,12325,12325,12325,0,12325,10510336".split(","))
        r2 = PerformanceTestResult(
            "1,AngryPhonebook,1,11616,11616,11616,0,11616,10502144".split(","))
        self.assertEqual(
            ReportFormatter.values(ResultComparison(r1, r2)),
            ("AngryPhonebook", "12325", "11616", "-5.8%", "1.06x"),
        )
        self.assertEqual(
            ReportFormatter.values(ResultComparison(r2, r1)),
            ("AngryPhonebook", "11616", "12325", "+6.1%", "0.94x"),
        )
        r2.max = r1.min + 1
        self.assertEqual(
            ReportFormatter.values(ResultComparison(r1, r2))[4],
            "1.06x (?)",  # is_dubious
        )
Exemplo n.º 2
0
    def test_values(self):
        self.assertEqual(
            ReportFormatter.values(
                PerformanceTestResult(
                    '1,AngryPhonebook,20,10664,12933,11035,576,10884'.split(
                        ','))),
            ('AngryPhonebook', '10664', '12933', '11035', '—'))
        self.assertEqual(
            ReportFormatter.values(
                PerformanceTestResult(
                    '1,AngryPhonebook,1,12045,12045,12045,0,12045,10510336'.
                    split(','))),
            ('AngryPhonebook', '12045', '12045', '12045', '10510336'))

        r1 = PerformanceTestResult(
            '1,AngryPhonebook,1,12325,12325,12325,0,12325,10510336'.split(','))
        r2 = PerformanceTestResult(
            '1,AngryPhonebook,1,11616,11616,11616,0,11616,10502144'.split(','))
        self.assertEqual(ReportFormatter.values(ResultComparison(
            r1, r2)), ('AngryPhonebook', '12325', '11616', '-5.8%', '1.06x'))
        self.assertEqual(ReportFormatter.values(ResultComparison(
            r2, r1)), ('AngryPhonebook', '11616', '12325', '+6.1%', '0.94x'))
        r2.max = r1.min + 1
        self.assertEqual(
            ReportFormatter.values(ResultComparison(r1, r2))[4],
            '1.06x (?)'  # is_dubious
        )
Exemplo n.º 3
0
 def test_values_is_dubious(self):
     self.assertFalse(ResultComparison(self.r1, self.r2).is_dubious)
     self.r2.max = self.r1.min + 1
     # new.min < old.min < new.max
     self.assertTrue(ResultComparison(self.r1, self.r2).is_dubious)
     # other way around: old.min < new.min < old.max
     self.assertTrue(ResultComparison(self.r2, self.r1).is_dubious)
Exemplo n.º 4
0
 def test_values_is_dubious(self):
     self.r2.max = self.r1.min + 1
     # new.min < old.min < new.max
     rc = ResultComparison(self.r1, self.r2)
     self.assertEquals(rc.values()[4], '1.06x (?)')
     # other way around: old.min < new.min < old.max
     rc = ResultComparison(self.r2, self.r1)
     self.assertEquals(rc.values()[4], '0.94x (?)')
Exemplo n.º 5
0
 def test_values(self):
     rc = ResultComparison(self.r1, self.r2)
     self.assertEquals(
         rc.values(),
         ('AngryPhonebook', '12325', '11616', '-5.8%', '1.06x')
     )
     # other way around
     rc = ResultComparison(self.r2, self.r1)
     self.assertEquals(
         rc.values(),
         ('AngryPhonebook', '11616', '12325', '+6.1%', '0.94x')
     )
Exemplo n.º 6
0
 def test_init(self):
     rc = ResultComparison(self.r1, self.r2)
     self.assertEqual(rc.name, "AngryPhonebook")
     self.assertAlmostEqual(rc.ratio, 12325.0 / 11616.0)
     self.assertAlmostEqual(rc.delta, (((11616.0 / 12325.0) - 1) * 100), places=3)
     # handle test results that sometimes change to zero, when compiler
     # optimizes out the body of the incorrectly written test
     rc = ResultComparison(self.r0, self.r0)
     self.assertEqual(rc.name, "GlobalClass")
     self.assertAlmostEqual(rc.ratio, 1)
     self.assertAlmostEqual(rc.delta, 0, places=3)
     rc = ResultComparison(self.r0, self.r01)
     self.assertAlmostEqual(rc.ratio, 0, places=3)
     self.assertAlmostEqual(rc.delta, 2000000, places=3)
     rc = ResultComparison(self.r01, self.r0)
     self.assertAlmostEqual(rc.ratio, 20001)
     self.assertAlmostEqual(rc.delta, -99.995, places=3)
     # disallow comparison of different test results
     self.assertRaises(AssertionError, ResultComparison, self.r0, self.r1)
 def test_values_is_dubious(self):
     self.r2.max = self.r1.min + 1
     # new.min < old.min < new.max
     rc = ResultComparison(self.r1, self.r2)
     self.assertEquals(rc.values()[4], '1.06x (?)')
     # other way around: old.min < new.min < old.max
     rc = ResultComparison(self.r2, self.r1)
     self.assertEquals(rc.values()[4], '0.94x (?)')
 def test_values(self):
     rc = ResultComparison(self.r1, self.r2)
     self.assertEquals(
         rc.values(),
         ('AngryPhonebook', '12325', '11616', '-5.8%', '1.06x'))
     # other way around
     rc = ResultComparison(self.r2, self.r1)
     self.assertEquals(
         rc.values(),
         ('AngryPhonebook', '11616', '12325', '+6.1%', '0.94x'))