Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cs444
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Xun Yang
cs444
Commits
3c42d6f8
Commit
3c42d6f8
authored
5 years ago
by
Nicholas Robinson
Browse files
Options
Downloads
Patches
Plain Diff
Test.py only output errors
parent
592614d8
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Test.py
+29
-15
29 additions, 15 deletions
Test.py
TypeNodes.py
+1
-1
1 addition, 1 deletion
TypeNodes.py
with
30 additions
and
16 deletions
Test.py
+
29
−
15
View file @
3c42d6f8
...
@@ -40,16 +40,27 @@ def a2Multiple():
...
@@ -40,16 +40,27 @@ def a2Multiple():
testCases
=
[
f
.
path
for
f
in
scandir
(
testDirectory
)
if
f
.
is_dir
()]
testCases
=
[
f
.
path
for
f
in
scandir
(
testDirectory
)
if
f
.
is_dir
()]
for
c
in
testCases
:
for
c
in
testCases
:
print
(
"
**********************************************************
"
)
#
print("**********************************************************")
print
(
"
DIRECTORY
"
)
#
print("DIRECTORY")
print
(
c
)
#
print(c)
print
(
"
**********************************************************
"
)
#
print("**********************************************************")
# get all files from stdlib folder
# get all files from stdlib folder
testFiles
=
[
join
(
dp
,
f
)
for
dp
,
dn
,
filenames
in
walk
(
'
stdlib/2.0/java/
'
)
for
f
in
filenames
]
testFiles
=
[
join
(
dp
,
f
)
for
dp
,
dn
,
filenames
in
walk
(
'
stdlib/2.0/java/
'
)
for
f
in
filenames
]
# get all files in the folder recursively
# get all files in the folder recursively
testFiles
+=
[
join
(
dp
,
f
)
for
dp
,
dn
,
filenames
in
walk
(
c
)
for
f
in
filenames
]
testFiles
+=
[
join
(
dp
,
f
)
for
dp
,
dn
,
filenames
in
walk
(
c
)
for
f
in
filenames
]
run
(
testFiles
)
ret
=
run
(
testFiles
)
print
(
"
\n
\n\n
"
)
if
ret
==
""
:
# print(c)
if
'
Je_
'
in
c
:
print
(
c
)
print
(
"
JE Passed without error
"
)
print
(
"
**********************************************************
"
)
else
:
if
not
'
Je_
'
in
c
:
print
(
c
)
print
(
ret
)
print
(
"
**********************************************************
"
)
# print("\n \n\n ")
...
@@ -57,7 +68,7 @@ def run(testFiles):
...
@@ -57,7 +68,7 @@ def run(testFiles):
parseTrees
=
[]
parseTrees
=
[]
for
f
in
testFiles
:
for
f
in
testFiles
:
print
(
f
)
#
print(f)
content
=
open
(
f
,
"
r
"
).
read
()
content
=
open
(
f
,
"
r
"
).
read
()
# Scanning
# Scanning
...
@@ -65,6 +76,7 @@ def run(testFiles):
...
@@ -65,6 +76,7 @@ def run(testFiles):
# Error in Scanning
# Error in Scanning
if
tokens
is
None
:
if
tokens
is
None
:
print
(
f
)
print
(
"
ERROR in Scanning:
"
+
error
)
print
(
"
ERROR in Scanning:
"
+
error
)
print
(
"
**********************************************************
"
)
print
(
"
**********************************************************
"
)
continue
continue
...
@@ -79,6 +91,7 @@ def run(testFiles):
...
@@ -79,6 +91,7 @@ def run(testFiles):
# No weeds if everything is good (weeds = None)
# No weeds if everything is good (weeds = None)
weeds
=
Weeding
.
fileNameCheck
(
tokens
,
f
)
weeds
=
Weeding
.
fileNameCheck
(
tokens
,
f
)
if
weeds
:
if
weeds
:
print
(
f
)
print
(
"
ERROR in Weeding after Scanning:
"
)
print
(
"
ERROR in Weeding after Scanning:
"
)
print
(
weeds
)
print
(
weeds
)
print
(
"
**********************************************************
"
)
print
(
"
**********************************************************
"
)
...
@@ -94,7 +107,7 @@ def run(testFiles):
...
@@ -94,7 +107,7 @@ def run(testFiles):
# Error in Parsing
# Error in Parsing
if
tree
is
None
:
if
tree
is
None
:
#
print(f)
print
(
f
)
print
(
"
ERROR in Parsing:
"
+
error
.
args
[
0
])
print
(
"
ERROR in Parsing:
"
+
error
.
args
[
0
])
# for n in error.args[1]: # the parse tree
# for n in error.args[1]: # the parse tree
# print(n)
# print(n)
...
@@ -103,8 +116,8 @@ def run(testFiles):
...
@@ -103,8 +116,8 @@ def run(testFiles):
parseTrees
.
append
((
f
,
tree
))
parseTrees
.
append
((
f
,
tree
))
print
(
"
Scan and Parse Succeeded
"
)
#
print("Scan and Parse Succeeded")
print
(
"
**********************************************************
"
)
#
print("**********************************************************")
ASTs
=
astBuild
(
parseTrees
)
ASTs
=
astBuild
(
parseTrees
)
...
@@ -119,9 +132,9 @@ def run(testFiles):
...
@@ -119,9 +132,9 @@ def run(testFiles):
buildEnvAndLink
(
ASTs
)
buildEnvAndLink
(
ASTs
)
except
Exception
as
e
:
except
Exception
as
e
:
# print(testFiles)
# print(testFiles)
print
(
"
error at environment building and linking
"
)
#
print("error at environment building and linking")
print
(
e
)
#
print(e)
return
return
"
buildEnvAndLink:
"
+
e
.
args
[
0
]
# print("<<<<------- after buildEnvAndLink -------->>>>>>")
# print("<<<<------- after buildEnvAndLink -------->>>>>>")
# for (n, t) in ASTs:
# for (n, t) in ASTs:
...
@@ -130,7 +143,8 @@ def run(testFiles):
...
@@ -130,7 +143,8 @@ def run(testFiles):
# t.printTree()
# t.printTree()
# print("\n \n\n \n")
# print("\n \n\n \n")
print
(
"
Succeeded
"
)
# print("Succeeded")
print
(
"
**********************************************************
"
)
# print("**********************************************************")
return
""
main
()
main
()
This diff is collapsed.
Click to expand it.
TypeNodes.py
+
1
−
1
View file @
3c42d6f8
...
@@ -126,7 +126,7 @@ class ClassNode(ASTNode):
...
@@ -126,7 +126,7 @@ class ClassNode(ASTNode):
# check if not acyclic
# check if not acyclic
if
self
.
name
in
hierarchy
:
if
self
.
name
in
hierarchy
:
raise
Exception
(
"
ERROR: The hierarchy is not acyclic
'
{}
'"
.
format
(
hierarchy
))
raise
Exception
(
"
ERROR: The hierarchy is not acyclic
'
{}
'
, saw
'
{}
'"
.
format
(
hierarchy
,
self
.
name
))
hierarchy
.
append
(
self
.
name
)
hierarchy
.
append
(
self
.
name
)
# get contains
# get contains
contains
=
self
.
methods
contains
=
self
.
methods
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment