| COMP3311 26T1 |
Assignment 2 Example Test Cases |
Database Systems |
[Assignment Spec] [SQL Schema] [Examples]
This document contains sample I/O sessions derived from the provided golden tests in tests/output.json. They illustrate required formatting and error handling. Outputs are deterministic; whitespace and ordering matter.
echo -e 'show\n/c\nterm 5024\nshow\nterm 5158\nterm 5000' | python3 ass2.py
> show
Term { unset }
> /c
> term 5024
> show
Term { unswid: 5024, year: 2002, term: S1, starting: 2002-03-04, ending: 2002-06-14 }
> term 5158
Term not set up yet, you cannot set this term.
> term 5000
Invalid term.
echo -e 'student 2281773\n/c\nterm 5024\nstudent 2281773\nstudent 9999999' | python3 ass2.py
> student 2281773
Term not configured. Use /c then term <...>.
> /c
> term 5024
> student 2281773
Student {
zid: z2281773
id: 1013041
name: Solailakshmi Wright
email: z2281773@student.unsw.edu.au
stype: local
program: Unknown
faculty: Unknown
}
> student 9999999
Student not found.
echo -e '/c\nterm 5054\nstudent 2281773' | python3 ass2.py
> /c
> term 5054
> student 2281773
Student {
zid: z2281773
id: 1013041
name: Solailakshmi Wright
email: z2281773@student.unsw.edu.au
stype: local
program: 1010 Chemical Engineering
faculty: Faculty of Engineering
}
echo -e '/c\nterm 5114\nstudent z2214291' | python3 ass2.py
> /c
> term 5114
> student z2214291
Student {
zid: z2214291
id: 1040032
name: Guro Aakredalen
email: z2214291@student.unsw.edu.au
stype: intl
program: 1640 Electrical Engineering
faculty: Faculty of Engineering
}
echo -e '/c\nterm 5114\nstudent 1002362' | python3 ass2.py
> /c
> term 5114
> student 1002362
Student {
zid: z1002362
id: 1177490
name: Kyle Ridsdill-Smith
email: z1002362@student.unsw.edu.au
stype: local
program: 5338 Engineering Science
faculty: Faculty of Engineering
}
echo -e '/c\nterm 5084\nstudent 2214291' | python3 ass2.py
> /c
> term 5084
> student 2214291
Student {
zid: z2214291
id: 1040032
name: Guro Aakredalen
email: z2214291@student.unsw.edu.au
stype: intl
program: Unknown
faculty: Unknown
}
echo -e '/c\nterm 5024\nstudent abc\nstudent 123\nstudent z12345678' | python3 ass2.py > /c > term 5024 > student abc Student not found. > student 123 Student not found. > student z12345678 Student not found.
echo -e '/c\nterm 5024\nenrol 2281773 COMP1001\nenrol 2281773 COMP1001\nenrol 2281773 XXXX0000\nenrol 2281773 COMP2091' | python3 ass2.py
> /c
> term 5024
> enrol 2281773 COMP1001
Timetable {
Tue 09-11 COMP1001 LAB EE EE-LG7
Tue 14-16 COMP1001 LAB EE EE-LG7
Tue 16-18 COMP1001 LAB EE EE-LG7
Wed 09-11 COMP1001 LAB EE EE-LG7
Wed 11-13 COMP1001 LAB EE EE-LG7
Wed 13-15 COMP1001 LAB EE EE-LG7
Wed 15-16 COMP1001 LEC EE EE-LG1
Wed 16-18 COMP1001 LAB EE EE-LG7
Thu 09-11 COMP1001 LAB EE EE-LG7
Thu 11-13 COMP1001 LAB EE EE-LG7
Thu 14-16 COMP1001 LAB EE EE-LG7
Thu 16-18 COMP1001 LAB EE EE-LG7
Fri 10-12 COMP1001 LAB EE EE-LG7
Fri 12-14 COMP1001 LAB EE EE-LG7
Fri 14-16 COMP1001 LAB EE EE-LG7
Fri 16-18 COMP1001 LAB EE EE-LG7
Sat 09-11 COMP1001 LAB EE EE-LG7
Sat 11-13 COMP1001 LAB EE EE-LG7
Sat 13-15 COMP1001 LAB EE EE-LG7
}
> enrol 2281773 COMP1001
Already enrolled in COMP1001.
Timetable {
Tue 09-11 COMP1001 LAB EE EE-LG7
Tue 14-16 COMP1001 LAB EE EE-LG7
Tue 16-18 COMP1001 LAB EE EE-LG7
Wed 09-11 COMP1001 LAB EE EE-LG7
Wed 11-13 COMP1001 LAB EE EE-LG7
Wed 13-15 COMP1001 LAB EE EE-LG7
Wed 15-16 COMP1001 LEC EE EE-LG1
Wed 16-18 COMP1001 LAB EE EE-LG7
Thu 09-11 COMP1001 LAB EE EE-LG7
Thu 11-13 COMP1001 LAB EE EE-LG7
Thu 14-16 COMP1001 LAB EE EE-LG7
Thu 16-18 COMP1001 LAB EE EE-LG7
Fri 10-12 COMP1001 LAB EE EE-LG7
Fri 12-14 COMP1001 LAB EE EE-LG7
Fri 14-16 COMP1001 LAB EE EE-LG7
Fri 16-18 COMP1001 LAB EE EE-LG7
Sat 09-11 COMP1001 LAB EE EE-LG7
Sat 11-13 COMP1001 LAB EE EE-LG7
Sat 13-15 COMP1001 LAB EE EE-LG7
}
> enrol 2281773 XXXX0000
Subject XXXX0000 not found.
> enrol 2281773 COMP2091
COMP2091 not offered in this term.
echo -e '/c\nterm 5024\nplan 2281773 COMP1091\nplan 2281773 COMP1091 ELEC1011 ELEC2031\nplan 2281773 COMP1091 XXXX0000\nplan 2281773 COMP1091 COMP2091' | python3 ass2.py
> /c
> term 5024
> plan 2281773 COMP1091
Plan {
COMP1091 LEC Tue 12-13 OMB OMB-112
COMP1091 TUT Thu 12-13 MAT MAT-929
}
> plan 2281773 COMP1091 ELEC1011 ELEC2031
Plan {
COMP1091 LEC Tue 12-13 OMB OMB-112
COMP1091 TUT Thu 12-13 MAT MAT-929
ELEC1011 LEC Wed 14-15 CLB CLB-6
ELEC1011 TUT Tue 16-17 MECH ME-503
ELEC2031 LEC Wed 09-10 EE EE-LG1
ELEC2031 TUT Thu 16-17 EE EE-LG1
}
> plan 2281773 COMP1091 XXXX0000
Subject XXXX0000 not found.
> plan 2281773 COMP1091 COMP2091
COMP2091 not offered in this term.
echo -e '/c\nterm 5024\noffer COMP1091 100 2\nadmin on\noffer COMP1091 100 2\nadmin off\noffer COMP1091 50 1' | python3 ass2.py > /c > term 5024 > offer COMP1091 100 2 Admin mode required. > admin on > offer COMP1091 100 2 Offering created: COMP1091 in term 5025 (course_id=74126) LEC Mon 09-11 CIVENG CE-G1 LEC Mon 09-11 EE EE-224 TUT Mon 09-10 EE EE-218 TUT Mon 09-10 EE EE-219 TUT Mon 09-10 EE EE-220 TUT Mon 09-10 EE EE-221 > admin off > offer COMP1091 50 1 Admin mode required.