11"""Tests for the MOSS interface package for CodeClassroom"""
22from plagcheck import plagcheck
3+ from plagcheck import analyze
34
45
56def test_check ():
67 """General test"""
7- language = "java "
8+ language = "python "
89 userid = "1"
910 temp = plagcheck .check (language , userid )
10- temp .addFilesByWildCard ("testfiles/test_java*.java " )
11+ temp .addFilesByWildCard ("testfiles/test_python*.py " )
1112 temp .submit ()
1213 results = temp .getResults ()
14+ insights = temp .getInsights ()
15+ share_scores = temp .getShareScores ()
16+
17+ assert share_scores == {'testfiles/test_python.py' : 2 ,
18+ 'testfiles/test_python2.py' : 2 ,
19+ 'testfiles/test_python3.py' : 2 }
20+
21+ assert insights == {
22+ 'DCtoC Paths' : [],
23+ 'DtoC Paths' : [],
24+ 'DtoDC Paths' : []}
1325
1426 assert results == [
15- {
16- "file1" : "testfiles/test_python.py" ,
17- "file2" : "testfiles/test_python3.py" ,
18- "percentage" : 90 ,
19- "no_of_lines_matched" : 3 ,
20- "lines_matched" : [["1-3" , "1-3" ]],
21- }
27+ {'file1' : 'testfiles/test_python2.py' ,
28+ 'file2' : 'testfiles/test_python3.py' ,
29+ 'lines_matched' : [['1-3' , '1-3' ]],
30+ 'no_of_lines_matched' : 3 ,
31+ 'percentage_file1' : 90 ,
32+ 'percentage_file2' : 90 },
33+ {'file1' : 'testfiles/test_python.py' ,
34+ 'file2' : 'testfiles/test_python3.py' ,
35+ 'lines_matched' : [['1-3' , '1-3' ]],
36+ 'no_of_lines_matched' : 3 ,
37+ 'percentage_file1' : 90 ,
38+ 'percentage_file2' : 90 },
39+ {'file1' : 'testfiles/test_python.py' ,
40+ 'file2' : 'testfiles/test_python2.py' ,
41+ 'lines_matched' : [['1-3' , '1-3' ]],
42+ 'no_of_lines_matched' : 3 ,
43+ 'percentage_file1' : 90 ,
44+ 'percentage_file2' : 90 }
2245 ]
2346
2447
@@ -30,3 +53,17 @@ def test_perc_str_to_int():
3053 assert result == 42
3154 result = plagcheck .perc_str_to_int ("(100%)" )
3255 assert result == 100
56+
57+
58+ def test_Mgroups ():
59+ mg = analyze .Mgroups ()
60+ mg .createNodes ({'1' , '2' , '3' })
61+
62+ mg .relatesTo (45 , 88 , '3' , '1' )
63+ mg .relatesTo (46 , 90 , '3' , '2' )
64+
65+ mg .set_tags ()
66+
67+ assert mg .d2dc () == []
68+ assert mg .d2c () == [('3' , '1' ), ('3' , '2' )]
69+ assert mg .dc2c () == []
0 commit comments