INT(1,50,k) NEWLINE REP(k) # Read the characters into an array until we hit a SPACE. REGEX("[a-z]", val) SET(alphabet[0]=val) WHILEI(i,val!=" ") REGEX("[a-z ]", val) IF (val!=" ") SET(alphabet[i+1]=val) END END # Make sure the characters in the alphabet are unique. ASSERT(UNIQUE(alphabet)) # Read characters until we hit another SPACE. # Each character must be in the alphabet. REGEX("[a-z]",val) ASSERT(INARRAY(val,alphabet)) WHILEI(i,val!=" ") REGEX("[a-z ]",val) IF (val!=" ") ASSERT(INARRAY(val,alphabet)) END ASSERT(i<=500) END # Read characters until we hit a NEWLINE. # Each character must be in the alphabet REGEX("[a-z]",val) ASSERT(INARRAY(val,alphabet)) WHILEI(i,val!="\n") REGEX("[a-z\n]",val) IF (val!="\n") ASSERT(INARRAY(val,alphabet)) END ASSERT(i<=500) END # Clear the alphabet for the next iteration. UNSET(alphabet) END # https://github.com/DOMjudge/checktestdata # https://github.com/DOMjudge/checktestdata/blob/main/doc/format-spec.md # # Quick reference: # # integer := 0|-?[1-9][0-9]* # float := -?[0-9]+(\.[0-9]+)?([eE][+-]?[0-9]+)? # string := ".*" # varname := [a-z][a-z0-9]* # variable := | '[' [',' ...] ']' # value := | | | | # compare := '<' | '>' | '<=' | '>=' | '==' | '!=' # logical := '&&' | '||' # expr := | [+-] # term := | [*%/] # factor := | '-' | '(' ')' | '^' # test := '!' | | '(' ')' | | # # Commands: # # MATCH( str) # ISEOF # UNIQUE( a [, b ...]) # INARRAY( val, var) # STRLEN( str) # SPACE / NEWLINE # EOF # INT( min, max [, name]) # FLOAT( min, max [, name [, option]]) # FLOATP( min, max, mindecimals, maxdecimals, [, name [, option]]) # STRING( str) # REGEX( str [, name]) # ASSERT( condition) # SET( name '=' value[, ...]) # UNSET( a [, b ...]) # REP( count [, separator]) [...] END # REPI( i, count [, separator]) [...] END # WHILE( condition [, separator]) [...] END # WHILEI( i, condition [, separator]) [...] END # IF( cond) [ cmds1...] [ELSE [ cmds2...]] END