MCPcopy Index your code
hub / github.com/Persper/code-analytics / test_az_basic

Function test_az_basic

test/test_graphs/test_analyzer.py:53–94  ·  view source on GitHub ↗
(az)

Source from the content-addressed store, hash-verified

51
52
53def test_az_basic(az):
54 az.analyze(from_beginning=True, into_branches=True)
55 assert_graph_match_history(az)
56
57 history_truth = {
58 'K': {'display': 5},
59 'F': {'display': 14, 'count': 12},
60 'E': {'append': 29, 'add': 11},
61 'D': {'str_replace': 26},
62 'C': {'str_append_chr': 34, 'str_equals': 1},
63 'B': {'str_append': 9, 'str_append_chr': 7, 'str_equals': 11},
64 'A': {'str_append': 7, 'str_len': 6},
65
66 # branch J from commit A, merge back through F
67 'J': {'count': 12, 'display': 14},
68
69 # branch G from commit B, merge back through D
70 'G': {'str_equals': 1, 'str_replace': 26},
71
72 # branch H from commit D, merge back through E
73 'I': {'add': 5, 'append': 35, 'insert': 25},
74 'H': {'add': 16, 'append': 12, 'insert': 25},
75 }
76
77 for commit in az.ri.repo.iter_commits():
78 assert(az.history[commit.hexsha] ==
79 history_truth[commit.message.strip()])
80
81 edges_truth = [
82 ('append', 'free'),
83 ('display', 'printf'),
84 ('str_replace', 'str_append_chr'),
85 ('str_replace', 'str_equals'),
86 ('str_replace', 'str_len'),
87 ('str_replace', 'str_append'),
88 ('str_append_chr', 'str_append_chr'),
89 ('str_append_chr', 'str_equals'),
90 ('str_append_chr', 'str_len'),
91 ('str_append_chr', 'str_append'),
92 ('add', 'malloc')
93 ]
94 assert(set(az.graph_server.get_graph().edges()) == set(edges_truth))
95
96
97def test_analyze_interface(az):

Callers

nothing calls this directly

Calls 4

edgesMethod · 0.80
analyzeMethod · 0.45
get_graphMethod · 0.45

Tested by

no test coverage detected