function eg(T, model, grammar) { print "\n-------[ Test " T " ]-------------------" if (T == 1) runFromGrammar(model, grammar) if (T == 2) runFromTxt("grammars/staticproject.txt", model, grammar) if (T == 3) egRewrite(grammar) if (T == 4) egMemos(grammar) if (T == 5) egAB(model, grammar) if (T == 6) egRiskRanges() if (T == 7) egReadRisks() if (T == 8) egRisks(model, grammar) } #T=1 function runFromGrammar(model, grammar, rewritten, \ project,effort,def,months) { rewritten = rewrite("project") getRatings(rewritten, project) project[getTuning("ksloc")] = 500 getTunings(project, model) effort = getEffort(project, model) def = totalDefects(project, model) months = getMonths(effort, project, model) print "ksloc: " project[getTuning("ksloc")] print "Effort: " effort print "Defects: " def print "Months: " months print "\nGenerated from: " print rewritten } function runFromTxt(infile, model, grammar, effort,def,months,tunings) { readData(infile, project, model) getTunings(project, model) project[getTuning("ksloc")] = 500 effort = getEffort(project, model) def = totalDefects(project, model) months = getMonths(effort, project, model) print "ksloc: " project[getTuning("ksloc")] print "A: " project[getTuning("a")] print "B: " project[getTuning("b")] print "Effort: " effort print "Defects: " def print "Months: " months print "\n(Generated from " infile ")" } #T=3 function egRewrite(grammar) { print "\nRewriting \"project\":" print rewrite("project") } #T=4 function egMemos(grammar, rewritten, memos) { rewritten = rewrite("project") print "\nTerminal sentence w/ memo metadata:" print rewritten print "\nExtracted memos:" getRatings(rewritten, memos) printDump(memos) } #T=5 function egAB(model, grammar, a, b, zzzz) { for (zzzz = 1; zzzz < 50; zzzz++) { a = getA() b = getB(a) print "a: "a" b:"b } } #T=6 function egRiskRanges() { setRiskRanges(modelRisks, "sced", 1, "cplx", 6, 4, "+", "-") for (key in modelRisks) print key " :: " modelRisks[key] } #T=7 function egReadRisks() { readRisks("grammars/risks.txt", modelRisks) printDump(modelRisks) } #T=8 function egRisks(model, grammar, project) { init(model, grammars) projStr = rewrite("project") print projStr }