forked from facebookarchive/fbkutils
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest_gapbs_parser.py
More file actions
82 lines (72 loc) · 2.84 KB
/
test_gapbs_parser.py
File metadata and controls
82 lines (72 loc) · 2.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
import unittest
from benchpress.plugins.parsers.gapbs import GAPBSParser
class TestGAPBSParser(unittest.TestCase):
def setUp(self):
self.parser = GAPBSParser()
def test_bc_sample_output(self):
output = [
'Generate Time: 0.41289',
'Build Time: 1.89460',
'Graph has 1048576 nodes and 16776968 undirected edges for degree: 15',
' a 0.00035',
'source: 209629',
' b 0.45253',
' p 0.31504',
'Trial Time: 0.76991',
'Average Time: 0.76991',
]
metrics = self.parser.parse(output, None, 0)
self.assertDictEqual({
'generate_time': 0.41289,
'build_time': 1.89460,
'trial_time': 0.76991,
'average_time': 0.76991,
}, metrics)
def test_bfs_sample_ouput(self):
output = [
'Generate Time: 0.41075',
'Build Time: 1.89220',
'Graph has 1048576 nodes and 16776968 undirected edges for degree: 15',
'Source: 209629',
' i 0.00086',
' td 29 0.00003',
' td 872 0.00002',
' td 27534 0.00049',
' td 579473 0.01030',
' e 0.00445',
' bu 440667 0.01020',
' bu 0 0.00044',
' c 0.00073',
'Trial Time: 0.02800',
'Average Time: 0.02800',
]
metrics = self.parser.parse(output, None, 0)
self.assertDictEqual({
'generate_time': 0.41075,
'build_time': 1.89220,
'trial_time': 0.02800,
'average_time': 0.02800,
}, metrics)
def test_tc_sample_output(self):
output = [
'Generate Time: 0.40949',
'Build Time: 1.88401',
'Graph has 1048576 nodes and 16776968 undirected edges for degree: 15',
'Trial Time: 2.45414',
'Average Time: 2.45414',
]
metrics = self.parser.parse(output, None, 0)
self.assertDictEqual({
'generate_time': 0.40949,
'build_time': 1.88401,
'trial_time': 2.45414,
'average_time': 2.45414,
}, metrics)
if __name__ == '__main__':
unittest.main()