;; (c) 2006,2007,2008,2009 Matthew Welland matt@kiatoa.com
;;
;; This file is part of Megatest.
;;
;; Megatest is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; Megatest is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with Megatest. If not, see <http://www.gnu.org/licenses/>.
;; License GPL.
;; ;; define your hooks
;; (hook:first-error "echo \"Error hook activated: #{escaped errmsg}\"")
;; (hook:first-warning "echo \"Got warning: #{escaped warnmsg}\"")
;; (hook:value "echo \"Value hook activated: expected=#{expected}, measured=#{measured}, tolerance=#{tolerance}, message=#{message}\"")
;;
;; ;; first ensure your run at least started
;; ;;
;; (trigger "Init" #/This is a header/)
;; (trigger "InitEnd" #/^\s*$/)
;; (section "Init" "Init" "InitEnd")
;;
;; (trigger "Body" #/^.*$/) ;; anything starts the body
;; ;; (trigger "EndBody" #/This had better never match/)
;;
;; (section "Body" "Body" "EndBody")
;;
;; (trigger "Blah2" #/^begin Blah2/)
;; (trigger "Blah2End" #/^end Blah2/)
;; (section "Blah2" "Blah2" "Blah2End")
;;
;; (expect:required in "Init" = 1 "Header" #/This is a header/)
;; (expect:required in "LogFileBody" > 0 "Something required but not found" #/This is required but not found/)
;; (expect:value in "LogFileBody" 1.9 0.1 "Output voltage" #/Measured voltage output:\s*([\d\.\+\-e]+)v/)
;; (expect:value in "LogFileBody" 0.5 0.1 "Output current" #/Measured output current:\s*([\d\.\+\-e]+)mA/)
;; (expect:value in "LogFileBody" 110e9 2e9 "A big number (first)" #/Freq:\s*([\d\.\+\-e]+)\s+Hz/)
;; (expect:value in "LogFileBody" 110e9 1e9 "A big number (second), hook not called" #/Freq:\s*([\d\.\+\-e]+)Hz/)
;; (expect:value in "LogFileBody" 110e9 1e9 "A big number (never activated)" #/Freq:\s*([\d\.\+\-e]+)zH/)
;;
;; ;; Using match number
;; (expect:value in "LogFileBody" 1.9 0.1 "Time Voltage" #/out: (\d+)\s+(\d+)/ match: 2)
;;
;; ;; Comparison instead of tolerance
;; (expect:value in "LogFileBody" 1.9 > "Time voltage" #/out: (\d+)\s+(\d+)/ match: 2)
;;
;; (expect:ignore in "Blah2" < 99 "FALSE ERROR" #/ERROR/)
;; (expect:ignore in "Body" < 99 "Ignore the word error in comments" #/^\/\/.*error/)
;; (expect:warning in "Body" = 0 "Any warning" #/WARNING/)
;; (expect:error in "Body" = 0 "ERROR BLAH" (list #/ERROR/ #/error/)) ;; but disallow any other errors
;;
;; ;(expect in "Init" < 1 "Junk" #/This is bogus/)