#NoEnv
SetBatchLines -1
SendMode Input
#SingleInstance Force
init()
drawGui()
init() {
global
Selected_Type_1 := 1
Selected_Type_2 := 1
Length := 0
Minimum_Num := 0
Maximum_Num := 0
Index := 0
Dictionary := []
Loop, Read, Dictionary.txt
{
Dictionary.Push(A_LoopReadLine)
}
Dic_Len := Dictionary.MaxIndex()
Dic_Ind := ""
Ind_Len := 0
ListStr := []
}
Return
drawGui() {
Gui, +HwndMainHWND +ToolWindow
Gui, Font, S8 CDefault, Verdana
Gui, Add, tab3, w250, What To Generate|Length of Selection
Gui, Add, Radio, Group Section vSelected_Type_1 Checked gSubmit, List
Gui, Add, Radio, gSubmit, Array
Gui, Add, Radio, ys Group vSelected_Type_2 Checked Section gSubmit, Strings
Gui, Add, Radio, gSubmit, Numbers
Gui, Add, Radio, gSubmit, Array of Numbers
Gui, Tab, 2
Gui, Add, Text, y+10 Section, Length:
Gui, Add, Edit, ys-4 w78 vLength Limit Number gSubmit, 0
Gui, Add, Text, xs Section y+15, Min. Chars
Gui, Add, Edit, ys-4 w25 vMinimum_Num Limit Number gSubmit, 0
Gui, Add, Text, ys, Max. Chars
Gui, Add, Edit, ys-4 w25 vMaximum_Num Limit Number gSubmit, 0
Gui, Tab
Gui, Add, Button, xm Default, &Generate
Gui, Show,, Test Case Generator
}
return
Submit:
gui, submit, nohide
return
gen_ListStr(Len, Min, Max)
{
Loop % ListStr.MaxIndex()
{
ListStr.Pop()
}
while ListStr.MaxIndex() < Len
{
MsgBox % ListStr[0] . ", " . ListStr[1] . ", " . ListStr[2] . ", " . ListStr[3] . ", " . ListStr[4] ;Testing for first 5 words
Random, Index, 0, Dic_Ind ; Randomly pick position from dictionary
MsgBox % "Index is " . Index . "!"
Dic_Ind = Dictionary[Index] ; Set the word at index randomly chosen^ in variable
MsgBox % "Chosen word is located at Dictionary index " . Dic_Ind . "."
Ind_Len = StrLen(Dic_Ind) ; Grab the length of the word chosen
MsgBox % "The length of this word is " . Ind_Len . " characters."
if (Ind_Len >= Min && Ind_Len <= Max) ; Is it within the minimum and maximum length of characters?
{
ListStr.Push(Dic_Ind) ; Append the word to the list of strings
}
}
}
return
restring(array)
{
res := ""
for i,val in array
res .= ", " . val
return substr(res, 3)
}
ButtonGenerate:
if (Selected_Type_1 = 1 && Selected_Type_2 = 1)
{
;MsgBox % "List of Strings | Length: " . Length . " | Min: " . Minimum_Num . " | Max: " . Maximum_Num
if Length !> 0
{
MsgBox % "Length of list needs to be above 0!"
}
else
{
gen_ListStr(Length, Minimum_Num, Maximum_Num)
MsgBox % restring(ListStr)
}
}
else if (Selected_Type_1 = 1 && Selected_Type_2 = 2)
{
MsgBox % "List of Numbers"
;gen_ListNum(Length, Minimum_Num, Maximum_Num)
}
else if (Selected_Type_1 = 1 && Selected_Type_2 = 3)
{
MsgBox % "List of Arrays"
;gen_ListArray(Length, Minimum_Num, Maximum_Num)
}
else if (Selected_Type_1 = 2 && Selected_Type_2 = 1)
{
MsgBox % "Array of Strings"
;gen_ArrayStr(Length, Minimum_Num, Maximum_Num)
}
else if (Selected_Type_1 = 2 && Selected_Type_2 = 2)
{
MsgBox % "Array of Numbers"
;gen_ArrayNum(Length, Minimum_Num, Maximum_Num)
}
else if (Selected_Type_1 = 2 && Selected_Type_2 = 3)
{
MsgBox % "Array of Arrays"
;gen_ArrayArs(Length, Minimum_Num, Maximum_Num)
}
else
{
MsgBox % "Huh?"
}
return