#! /usr/bin/sbcl --script
; ******************************************************
; THE TEST CASES/CALLS BELOW ARE MERELY A STARTING POINT
; FOR TESTING YOUR CODE, THEY ARE NOT ADEQUATE TO ENSURE
; YOUR CODE IS ANYWHERE CLOSE TO SUFFICIENT
; ******************************************************
; ensure the lab3 macros and functions are correctly loaded
(load "lab3.cl")
(format t "---~%")
(format t "lab3.cl macro and function loading complete~%")
(format t "---~%")
; some basic grades for use in testing
(defvar CS159D '("CSCI" 159 4 "D"))
(defvar CS159Cm '("CSCI" 159 4 "C-"))
(defvar CS265F '("CSCI" 265 3 "F"))
(defvar CS265B '("CSCI" 265 3 "B"))
(defvar CS265Ap '("CSCI" 265 3 "A+"))
(defvar MA123C '("MATH" 123 3 "C"))
(defvar MA123A '("MATH" 123 3 "A"))
(defvar MA265B '("MATH" 265 3 "B"))
(defvar notAList 99)
(defvar missField '("CSCI" 4 "C+"))
(defvar xtraField '("CSCI" 100 4 "C+" 1))
(defvar badArea '(100 123 3 "C-"))
(defvar badNum '("MATH" "123" 3 "C-"))
(defvar badCred '("MATH" 123 "3" "C-"))
(defvar badLetter '("MATH" 123 3 #\C))
(format t "~%Checking some macro expansions~%")
(format t "(grArea CS159D) expanded: ~A~%" (macroexpand-1 '(grArea CS159D)))
(format t "(grNum CS159D) expanded: ~A~%" (macroexpand-1 '(grNum CS159D)))
(format t "(grCred CS159D) expanded: ~A~%" (macroexpand-1 '(grCred CS159D)))
(format t "(grLetter CS159D) expanded: ~A~%" (macroexpand-1 '(grLetter CS159D)))
(format t "(letterRank CS159D) expanded: ~A~%" (macroexpand-1 '(letterRank CS159D)))
(format t "~%(okGradeForm CS159D) expanded: ~A~%" (macroexpand-1 '(okGradeForm CS159D)))
(format t "~%(courseMatch CS159D CS159Cm) expanded: ~A~%" (macroexpand-1 '(courseMatch CS159D CS159Cm)))
(format t "~%(reqPassed CS159D CS159Cm MA123C) expanded: ~A~%" (macroexpand-1 '(reqPassed CS159D CS159Cm MA123C)))
(format t "---~%")
(format t "~%Checking valid grades with okGradeForm, each should pass~%")
(format t "~A: result ~A~%" CS159D (okGradeForm CS159D))
(format t "~A: result ~A~%" CS159Cm (okGradeForm CS159Cm))
(format t "~A: result ~A~%" CS265F (okGradeForm CS265F))
(format t "~A: result ~A~%" CS265B (okGradeForm CS265B))
(format t "~A: result ~A~%" CS265Ap (okGradeForm CS265Ap))
(format t "~A: result ~A~%" MA123C (okGradeForm MA123C))
(format t "~A: result ~A~%" MA123A (okGradeForm MA123A))
(format t "---~%")
(format t "~%Checking invalid grades with okGradeForm, each should fail~%")
(format t "~A: result ~A~%" notAList (okGradeForm notAList))
(format t "~A: result ~A~%" missField (okGradeForm missField))
(format t "~A: result ~A~%" xtraField (okGradeForm xtraField))
(format t "~A: result ~A~%" badArea (okGradeForm badArea))
(format t "~A: result ~A~%" badNum (okGradeForm badNum))
(format t "~A: result ~A~%" badCred (okGradeForm badCred))
(format t "~A: result ~A~%" badLetter (okGradeForm badLetter))
(format t "---~%")
(format t "~%Checking course matches, each should pass~%")
(format t "Req and Act ~A (same var): result ~A~%" CS159Cm (courseMatch CS159Cm CS159Cm))
(format t "Req ~A, Act ~A (match): result ~A~%" MA123C MA123A (courseMatch MA123C MA123A))
(format t "Req ~A, Act ~A (match): result ~A~%" CS265Ap CS265B (courseMatch CS265Ap CS265B))
(format t "---~%")
(format t "~%Checking course matches, each should fail~%")
(format t "Req ~A (invalid), Act ~A: result ~A~%" notAList CS159D (courseMatch notAList CS159D))
(format t "Req ~A, Act ~A (invalid): result ~A~%" CS159D badNum (courseMatch CS159D badNum))
(format t "Req ~A, Act ~A (mismatch num): result ~A~%" CS159Cm CS265B (courseMatch CS159Cm CS265B))
(format t "Req ~A, Act ~A (mismatch area): result ~A~%" CS265B MA265B (courseMatch CS265B MA265B))
(format t "---~%")
(format t "~%Checking actual grades vs required, each should pass~%")
(format t "Req and Act ~A (exact match): result ~A~%" CS159Cm (meetsReq CS159Cm CS159Cm))
(format t "Req ~A, Act ~A (higher): result ~A~%" MA123C MA123A (meetsReq MA123C MA123A))
(format t "Req ~A (invalid), Act ~A: result ~A~%" badLetter CS159D (meetsReq badLetter CS159D))
(format t "---~%")
(format t "~%Checking actual grades vs required, each should fail~%")
(format t "Req ~A, Act ~A (mismatch): result ~A~%" CS159Cm CS265B (meetsReq CS159Cm CS265B))
(format t "Req ~A, Act ~A (mismatch): result ~A~%" CS265B MA265B (meetsReq CS265B MA265B))
(format t "Req ~A, Act ~A (too low): result ~A~%" CS265Ap CS265B (meetsReq CS265Ap CS265B))
(format t "Req ~A, Act ~A (invalid): result ~A~%" CS159D badCred (meetsReq CS159D badCred))
(format t "---~%")
(format t "~%Checking multiple actual grade args vs req using reqPassed, each should pass~%")
(format t "Req ~A, Act ~A (higher): result ~A~%" MA123C MA123A (reqPassed MA123C MA123A))
(format t "Req ~A Act ~A,~A,~A: result ~A~%" CS265B MA123A CS265F CS265Ap (reqPassed CS265B MA123A CS265F CS265Ap))
(format t "Req ~A (invalid), Act ~A, ~A: result ~A~%" xtraField CS159D CS265F (reqPassed xtraField CS159D CS265F))
(format t "Req ~A (invalid), no actual: result ~A~%" missField (reqPassed missField))
(format t "---~%")
(format t "~%Checking multiple actual grade args vs required, each should fail~%")
(format t "Req ~A, Act ~A, ~A, ~A (too low): result ~A~%" CS159Cm CS265B CS159D MA123C (reqPassed CS159Cm CS265B MA123C))
(format t "Req ~A, Act ~A (invalid): result ~A~%" CS159D badArea (reqPassed CS159D badArea))
(format t "Req ~A, no actuals: result ~A~%" MA123A (reqPassed MA123A))
(format t "---~%")
---
lab3.cl macro and function loading complete
---
Checking some macro expansions
(grArea CS159D) expanded: (NTH 0 CS159D)
(grNum CS159D) expanded: (NTH 1 CS159D)
(grCred CS159D) expanded: (NTH 2 CS159D)
(grLetter CS159D) expanded: (NTH 3 CS159D)
(letterRank CS159D) expanded: (POSITION (GRLETTER CS159D) LETTERS TEST
#'STRING=)
(okGradeForm CS159D) expanded: (AND (LISTP CS159D) (= 4 (LENGTH CS159D))
(STRINGP (GRAREA CS159D))
(INTEGERP (GRNUM CS159D))
(INTEGERP (GRCRED CS159D))
(STRINGP (GRLETTER CS159D)))
(courseMatch CS159D CS159Cm) expanded: (AND (OKGRADEFORM CS159D)
(OKGRADEFORM CS159CM)
(STRING= (GRAREA CS159D)
(GRAREA CS159CM))
(= (GRNUM CS159D) (GRNUM CS159CM))
(= (GRCRED CS159D)
(GRCRED CS159CM)))
(reqPassed CS159D CS159Cm MA123C) expanded: (IF (MEETSREQ CS159D CS159CM)
T
(REQPASSED CS159D MA123C))
---
Checking valid grades with okGradeForm, each should pass
(CSCI 159 4 D): result T
(CSCI 159 4 C-): result T
(CSCI 265 3 F): result T
(CSCI 265 3 B): result T
(CSCI 265 3 A+): result T
(MATH 123 3 C): result T
(MATH 123 3 A): result T
---
Checking invalid grades with okGradeForm, each should fail
99: result NIL
(CSCI 4 C+): result NIL
(CSCI 100 4 C+ 1): result NIL
(100 123 3 C-): result NIL
(MATH 123 3 C-): result NIL
(MATH 123 3 C-): result NIL
(MATH 123 3 C): result NIL
---
Checking course matches, each should pass
Req and Act (CSCI 159 4 C-) (same var): result T
Req (MATH 123 3 C), Act (MATH 123 3 A) (match): result T
Req (CSCI 265 3 A+), Act (CSCI 265 3 B) (match): result T
---
Checking course matches, each should fail
Req 99 (invalid), Act (CSCI 159 4 D): result NIL
Req (CSCI 159 4 D), Act (MATH 123 3 C-) (invalid): result NIL
Req (CSCI 159 4 C-), Act (CSCI 265 3 B) (mismatch num): result NIL
Req (CSCI 265 3 B), Act (MATH 265 3 B) (mismatch area): result NIL
---
Checking actual grades vs required, each should pass
Req and Act (CSCI 159 4 C-) (exact match): result T
Req (MATH 123 3 C), Act (MATH 123 3 A) (higher): result T
Req (MATH 123 3 C) (invalid), Act (CSCI 159 4 D): result T
---
Checking actual grades vs required, each should fail
Req (CSCI 159 4 C-), Act (CSCI 265 3 B) (mismatch): result NIL
Req (CSCI 265 3 B), Act (MATH 265 3 B) (mismatch): result NIL
Req (CSCI 265 3 A+), Act (CSCI 265 3 B) (too low): result NIL
Req (CSCI 159 4 D), Act (MATH 123 3 C-) (invalid): result NIL
---
Checking multiple actual grade args vs req using reqPassed, each should pass
Req (MATH 123 3 C), Act (MATH 123 3 A) (higher): result T
Req (CSCI 265 3 B) Act (MATH 123 3 A),(CSCI 265 3 F),(CSCI 265 3 A+): result T
Req (CSCI 100 4 C+ 1) (invalid), Act (CSCI 159 4 D), (CSCI 265 3 F): result T
Req (CSCI 4 C+) (invalid), no actual: result T
---
Checking multiple actual grade args vs required, each should fail
Req (CSCI 159 4 C-), Act (CSCI 265 3 B), (CSCI 159 4 D), (MATH 123 3 C) (too low): result NIL
Req (CSCI 159 4 D), Act (100 123 3 C-) (invalid): result NIL
Req (MATH 123 3 A), no actuals: result NIL
---
|