Skip to content

Commit 8e94835

Browse files
committed
Move struct definition test file
1 parent a220d62 commit 8e94835

File tree

2 files changed

+33
-32
lines changed

2 files changed

+33
-32
lines changed

test/runtests.jl

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,38 +3,7 @@ using Test, Suppressor, DataFrames
33

44
stripall(x::String) = replace(x, r"\s|\n"=>"")
55

6-
# Type Definition
7-
@aml mutable struct Person "person", check_course
8-
age::UInt64, "~"
9-
field, "study-field"
10-
GPA::Float64 = 4.5, "~", GPAcheck
11-
courses::Vector{String}, "taken-courses"
12-
professors::UN{DataFrame} = nothing, "table"
13-
id::Int64, att"~"
14-
comment::UN{String} = nothing, txt"end"
15-
end
16-
17-
@aml mutable struct University doc"university"
18-
name, att"university-name"
19-
people::Vector{Person}, "person"
20-
end
21-
22-
# Value Checking Functions
23-
GPAcheck(x) = x <= 4.5 && x >= 0
24-
25-
function check_course(age, field, GPA, courses, professors, id, comment)
26-
27-
if field == "Mechanical Engineering"
28-
relevant = ["Artificial Intelligence", "Robotics", "Machine Design"]
29-
elseif field == "Computer Engineering"
30-
relevant = ["Julia", "Algorithms"]
31-
else
32-
error("study field is not known")
33-
end
34-
35-
return any(in.(courses, Ref(relevant)))
36-
end
37-
6+
include("struct_definition.jl")
387
include("creator.jl")
398
include("extractor.jl")
409
include("tables.jl")

test/struct_definition.jl

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
2+
# Type Definition
3+
@aml mutable struct Person "person", check_course
4+
age::UInt64, "~"
5+
field, "study-field"
6+
GPA::Float64 = 4.5, "~", GPAcheck
7+
courses::Vector{String}, "taken-courses"
8+
professors::UN{DataFrame} = nothing, "table"
9+
id::Int64, att"~"
10+
comment::UN{String} = nothing, txt"end"
11+
end
12+
13+
@aml mutable struct University doc"university"
14+
name, att"university-name"
15+
people::Vector{Person}, "person"
16+
end
17+
18+
# Value Checking Functions
19+
GPAcheck(x) = x <= 4.5 && x >= 0
20+
21+
function check_course(age, field, GPA, courses, professors, id, comment)
22+
23+
if field == "Mechanical Engineering"
24+
relevant = ["Artificial Intelligence", "Robotics", "Machine Design"]
25+
elseif field == "Computer Engineering"
26+
relevant = ["Julia", "Algorithms"]
27+
else
28+
error("study field is not known")
29+
end
30+
31+
return any(in.(courses, Ref(relevant)))
32+
end

0 commit comments

Comments
 (0)