Simple XML-based language created for Competetive Programmers to quickly generate random tests for competitions
Every .cptg
file should start with <test>
tag and end with </test>
tag
<test>
<!-- variables, sequences, etc -->
</test>
<var/>
- Variable is used to display various types of randomly generated data.
By default, a variable is a
Number
in the range of0-9
, but it can be modified with parameters.
<const/>
- Constant is similar to variable, but the only parameter it
supports is
value
which is used to specify their... value and unlike variable, constant is static
<seq/>
- Sequence is used to repeat a group of tags without copying and pasting (you can think of it as a loop)
- you can specify different parameters to make it work differently
- sequences can be nested e.g.
<test>
<seq times="3">
<seq times="2">
<const value="1"/>
</seq>
</seq>
</test>
<!-- Output: 1 1 1 1 1 1 -->
available parameters
type
- default:
Number
- used to specify the type of data that will be generated
- available values:
Char
Number
Float
String
- default:
range
- default:
- for
Number
andFloat
:0:9
- for
String
andChar
:abc
- for
- used to specify variable generator range
- available values:
- for
Number
andFloat
:n1:n2
(random numbers from n1 to n2)- e.g:
<var type="Number" range="-900:900" />
random number in the range of[-900;900]
- e.g:
- for
String
andChar
:abc
generates random lowercase Latin alphabet letterABC
generates random uppercase Latin alphabet letterspecial
generates random "special character"- list of special characters:
! @ # $ % ^ & * ( ) - _ + = { } [ ] : ; " ' < > , . ? / | \ ~
- list of special characters:
all
generates random lowercase Latin alphabet letter, uppercase Latin alphabet letter or random special character
- for
- default:
length
- default:
3
- only avaliable fo
String
andFloat
- for
String
it specifies the number of characters - for
Float
it specifies the number of places after the decimal point
- for
- default:
available parameters
value
- default:
None
, must be specified - specifies constant value
- default:
available parameters
times
- default:
1
- specifies how many times sequence will repeat
- default:
- adds a breakpoint (
\n
) - nothing else
Code
<test>
<!-- just putting <var/> here without any parameters will
generate a random number from 0 to 9 -->
<var/>
</test>
Example Output
2
Code
<test>
<!-- sequence example -->
<seq times="5">
<var/>
</seq>
</test>
Example Output
2 3 1 5 6
Code
<test>
<seq times="6">
<seq times="5">
<var/>
</seq>
<br/>
</seq>
</test>
Example Output
2 3 1 5 6
7 9 1 2 3
0 9 8 2 9
2 0 3 1 9
4 0 9 2 8
9 0 2 1 3
Code
<test>
<!-- variables can be of different types -->
<seq times="3">
<var type="Char" range="abc" />
<var type="Char" range="ABC" />
<var type="Char" range="special" />
<var type="Char" range="all" />
<var type="String" range="all" length="5" />
<br/>
</seq>
</test>
Example Output
a B & # b$%cA
b D ^ $ sdnD@
p L ( w wdaio
Code
<test>
<!-- you can also define constants -->
<const value="5"/>
<const value="test"/>
<const value="123"/>
</test>
Example Output
5 test 123
Code
<test>
<!-- you can also add breaks -->
<const value="5"/>
<const value="test"/>
<br/>
<const value="123"/>
</test>
Example Output
5 test
123
@ maintained by github/foealke