public void CreateTextForDirective() { Setup(); Textifier textifier = new Textifier(eventDB, symbolDB, "en"); Assert.AreEqual("Follow tapes 230 m between controls", textifier.CreateTextForDirective("13.2", "230 m")); }
public void Custom() { Setup(); Textifier textifier = new Textifier(eventDB, symbolDB, "en"); Assert.AreEqual("very marshy spot", textifier.CreateTextForControl(ControlId(4), "50 m")); }
public void Start() { Setup(); Textifier textifier = new Textifier(eventDB, symbolDB, "en"); Assert.AreEqual("Start: open bare rock", textifier.CreateTextForControl(ControlId(1), "")); }
public void SimpleCombo() { Setup(); Textifier textifier = new Textifier(eventDB, symbolDB, "en"); Assert.AreEqual("Knoll and boulder", textifier.CreateTextForControl(ControlId(14), "")); }
[TestMethod] public void GermanPluralAgreement() { SetupWithGerman(); Textifier textifier = new Textifier(eventDB, symbolDB, "de"); Assert.AreEqual("De-between de-overgrown-plural-neut de-pits", textifier.CreateTextForControl(ControlId(9), "")); Assert.AreEqual("De-between de-overgrown-plural-masc de-marshes", textifier.CreateTextForControl(ControlId(13), "")); Assert.AreEqual("De-between de-overgrown-plural-fem de-reentrants", textifier.CreateTextForControl(ControlId(14), "")); }
public void MissingMainSymbol() { Setup(); Textifier textifier = new Textifier(eventDB, symbolDB, "en"); Assert.AreEqual("S ", textifier.CreateTextForControl(ControlId(19), "")); Assert.AreEqual("", textifier.CreateTextForControl(ControlId(21), "")); }
public void Capitalize() { Setup(); Assert.AreEqual(null, Textifier.CapitalizeFirstLetter(null)); Assert.AreEqual("", Textifier.CapitalizeFirstLetter("")); Assert.AreEqual("A", Textifier.CapitalizeFirstLetter("a")); Assert.AreEqual("Z", Textifier.CapitalizeFirstLetter("Z")); Assert.AreEqual("Étude", Textifier.CapitalizeFirstLetter("étude")); Assert.AreEqual("Hi there", Textifier.CapitalizeFirstLetter("hi there")); }
public void ShowText() { Setup(); Textifier textifier = new Textifier(eventDB, symbolDB, "en"); foreach (Id <ControlPoint> controlId in eventDB.AllControlPointIds) { Console.WriteLine("{0}: '{1}'", controlId, textifier.CreateTextForControl(controlId, "160 m")); } }
public void CustomSymbolsOtherLanguage() { Setup(); Textifier textifier = new Textifier(eventDB, symbolDB, "aa"); Assert.AreEqual("Marshy special item", textifier.CreateTextForControl(ControlId(25), "")); Assert.AreEqual("Smurf (first aid)", textifier.CreateTextForControl(ControlId(26), "")); Assert.AreEqual("S side of bigrash", textifier.CreateTextForControl(ControlId(27), "")); Assert.AreEqual("Between smurfella", textifier.CreateTextForControl(ControlId(29), "")); Assert.AreEqual("Knoll and boulder", textifier.CreateTextForControl(ControlId(14), "")); }
public void CustomSymbols() { Setup(); Textifier textifier = new Textifier(eventDB, symbolDB, "en"); Assert.AreEqual("Wet man-made object", textifier.CreateTextForControl(ControlId(25), "")); Assert.AreEqual("Slide (medical)", textifier.CreateTextForControl(ControlId(26), "")); Assert.AreEqual("S side of light pole", textifier.CreateTextForControl(ControlId(27), "")); Assert.AreEqual("Between slides", textifier.CreateTextForControl(ControlId(29), "")); Assert.AreEqual("Knoll and boulder", textifier.CreateTextForControl(ControlId(14), "")); }
public void Directives() { Setup(); Textifier textifier = new Textifier(eventDB, symbolDB, "en"); Assert.AreEqual("Mandatory crossing point", textifier.CreateTextForControl(ControlId(3), "")); Assert.AreEqual("Navigate 160 m to finish funnel", textifier.CreateTextForControl(ControlId(6), "160 m")); Assert.AreEqual("Mandatory crossing point", textifier.CreateTextForControl(ControlId(15), "160 m")); Assert.AreEqual("Navigate to finish funnel", textifier.CreateTextForControl(ControlId(6), "")); Assert.AreEqual("Mandatory crossing point", textifier.CreateTextForControl(ControlId(15), "")); }
public void Between() { Setup(); Textifier textifier = new Textifier(eventDB, symbolDB, "en"); Assert.AreEqual("Between building and statue", textifier.CreateTextForControl(ControlId(8), "")); Assert.AreEqual("Between marshes, 4m by 4m and 5m by 6m", textifier.CreateTextForControl(ControlId(9), "")); Assert.AreEqual("Between path crossings", textifier.CreateTextForControl(ControlId(11), "")); Assert.AreEqual("Between boulders, 0.5m to 2.5m high", textifier.CreateTextForControl(ControlId(12), "")); }
public void JunctionCrossings() { Setup(); Textifier textifier = new Textifier(eventDB, symbolDB, "en"); Assert.AreEqual("N side of N power line and path crossing (radio)", textifier.CreateTextForControl(ControlId(5), "")); Assert.AreEqual("Small gully junction", textifier.CreateTextForControl(ControlId(7), "")); Assert.AreEqual("N side of road and power line crossing", textifier.CreateTextForControl(ControlId(10), "")); Assert.AreEqual("N path junction", textifier.CreateTextForControl(ControlId(13), "")); }
public void GermanGenderAgreement() { SetupWithGerman(); Textifier textifier = new Textifier(eventDB, symbolDB, "de"); Assert.AreEqual("De-overgrown-masc de-marsh", textifier.CreateTextForControl(ControlId(28), "")); Assert.AreEqual("De-overgrown-fem de-reentrant, 4m de-deep-fem", textifier.CreateTextForControl(ControlId(12), "")); Assert.AreEqual("De-overgrown-neut de-pit, 4m de-deep-neut", textifier.CreateTextForControl(ControlId(29), "")); Assert.AreEqual("De-between de-pit and de-reentrant, 6m de-deep-neut and 3m de-deep-fem", textifier.CreateTextForControl(ControlId(7), "")); Assert.AreEqual("De-N-masc side of de-upper-masc de-marsh", textifier.CreateTextForControl(ControlId(8), "")); Assert.AreEqual("De-N-fem side of de-upper-fem de-reentrant", textifier.CreateTextForControl(ControlId(11), "")); Assert.AreEqual("De-N-neut side of de-upper-neut de-pit", textifier.CreateTextForControl(ControlId(10), "")); }
public void Normal() { Setup(); Textifier textifier = new Textifier(eventDB, symbolDB, "en"); Assert.AreEqual("Upper boulder, 2m high", textifier.CreateTextForControl(ControlId(2), "")); Assert.AreEqual("Overgrown pit, 3m deep", textifier.CreateTextForControl(ControlId(16), "")); Assert.AreEqual("S side of pit", textifier.CreateTextForControl(ControlId(17), "")); Assert.AreEqual("Reentrant, 4m deep", textifier.CreateTextForControl(ControlId(18), "")); Assert.AreEqual("Upper boulder, 2m high", textifier.CreateTextForControl(ControlId(2), "")); Assert.AreEqual("E edge of SE overgrown pond", textifier.CreateTextForControl(ControlId(28), "")); Assert.AreEqual("Stony ground, 6m by 7m (manned)", textifier.CreateTextForControl(ControlId(20), "")); }
public void PolishNounCases() { SetupWithPolish(); Textifier textifier = new Textifier(eventDB, symbolDB, "pl"); Assert.AreEqual("Suchy row", textifier.CreateTextForControl(ControlId(1), "")); Assert.AreEqual("Polnocny suchy row", textifier.CreateTextForControl(ControlId(2), "")); Assert.AreEqual("Piaszczysty suchy row", textifier.CreateTextForControl(ControlId(3), "")); Assert.AreEqual("Skrzyzowanie suchych rowow", textifier.CreateTextForControl(ControlId(4), "")); Assert.AreEqual("Polnocna strona suchego rowu", textifier.CreateTextForControl(ControlId(5), "")); Assert.AreEqual("Suchy row, gleboki na 1.5m", textifier.CreateTextForControl(ControlId(6), "")); Assert.AreEqual("Rozwidlenie suchego rowu oraz sciezki", textifier.CreateTextForControl(ControlId(7), "")); Assert.AreEqual("Mulda", textifier.CreateTextForControl(ControlId(8), "")); Assert.AreEqual("Zachodnia mulda", textifier.CreateTextForControl(ControlId(9), "")); Assert.AreEqual("Piaszczysta mulda", textifier.CreateTextForControl(ControlId(10), "")); Assert.AreEqual("Skrzyzowanie muld", textifier.CreateTextForControl(ControlId(11), "")); Assert.AreEqual("Polnocna strona muldy", textifier.CreateTextForControl(ControlId(12), "")); //Assert.AreEqual("Mulda, gleboka na 1m do 2m", textifier.CreateTextForControl(ControlId(13), "")); Assert.AreEqual("Rozwidlenie muldy oraz sciezki", textifier.CreateTextForControl(ControlId(14), "")); }
public void GetTextFromSize() { Setup(); Textifier textifier = new Textifier(eventDB, symbolDB, "en"); Assert.AreEqual("5m high", textifier.GetTextFromSize("5", true, false, "", false, "")); Assert.AreEqual("5m deep", textifier.GetTextFromSize("5m", true, true, "", true, "")); Assert.AreEqual("5m deep", textifier.GetTextFromSize("5 m", true, true, "", true, "")); Assert.AreEqual("5m high", textifier.GetTextFromSize("5.0", true, false, "", false, "")); Assert.AreEqual("5m high", textifier.GetTextFromSize("5.0m ", true, false, "", false, "")); Assert.AreEqual("0.6m high", textifier.GetTextFromSize(".6 ", true, false, "", false, "")); Assert.AreEqual("4m by 3m", textifier.GetTextFromSize("4.0x3.0", true, false, "", false, "")); Assert.AreEqual("4m by 3m", textifier.GetTextFromSize("4x3", true, true, "", true, "")); Assert.AreEqual("0.5m to 3m high", textifier.GetTextFromSize("0.5/3", true, false, "", false, "")); Assert.AreEqual("0.5m to 3m deep", textifier.GetTextFromSize("0.5m/3m", true, true, "", true, "")); Assert.AreEqual("0.5m deep and 3m high", textifier.GetTextFromSize("0.5|3", true, true, "", false, "")); Assert.AreEqual("0.5m deep and 3.2m deep", textifier.GetTextFromSize("0,5|3.2", true, true, "", true, "")); Assert.AreEqual("2m by 3m and 5m by 7m", textifier.GetTextFromSize("2x3|5x7", true, false, "", false, "")); }
public void GetTextFromSizeDecimalStyles() { Setup(); Textifier textifier = new Textifier(eventDB, symbolDB, "en"); Assert.AreEqual("5m high", textifier.GetTextFromSize("5.0", true, false, "", false, "")); Assert.AreEqual("5m deep", textifier.GetTextFromSize("5,0", true, true, "", true, "")); Assert.AreEqual("5.2m deep", textifier.GetTextFromSize("5.2", true, true, "", true, "")); Assert.AreEqual("5.2m high", textifier.GetTextFromSize("5,2", true, false, "", false, "")); CultureInfo.CurrentCulture.ClearCachedData(); CultureInfo prev = Thread.CurrentThread.CurrentCulture; try { Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-FR"); Assert.AreEqual("5m deep", textifier.GetTextFromSize("5.0", true, true, "", true, "")); Assert.AreEqual("5m high", textifier.GetTextFromSize("5,0", true, false, "", false, "")); Assert.AreEqual("5,2m high", textifier.GetTextFromSize("5.2", true, false, "", false, "")); Assert.AreEqual("5,2m deep", textifier.GetTextFromSize("5,2", true, true, "", true, "")); } finally { CultureInfo.CurrentCulture.ClearCachedData(); Thread.CurrentThread.CurrentCulture = prev; } }
public void GermanPluralAgreement() { SetupWithGerman(); Textifier textifier = new Textifier(eventDB, symbolDB, "de"); Assert.AreEqual("De-between de-overgrown-plural-neut de-pits", textifier.CreateTextForControl(ControlId(9), "")); Assert.AreEqual("De-between de-overgrown-plural-masc de-marshes", textifier.CreateTextForControl(ControlId(13), "")); Assert.AreEqual("De-between de-overgrown-plural-fem de-reentrants", textifier.CreateTextForControl(ControlId(14), "")); }
public void ShowText() { Setup(); Textifier textifier = new Textifier(eventDB, symbolDB, "en"); foreach (Id<ControlPoint> controlId in eventDB.AllControlPointIds) { Console.WriteLine("{0}: '{1}'", controlId, textifier.CreateTextForControl(controlId, "160 m")); } }
public void SimpleGerman() { SetupWithGerman(); Textifier textifier = new Textifier(eventDB, symbolDB, "de"); Assert.AreEqual("De-marsh", textifier.CreateTextForControl(ControlId(4), "")); }
private static string DetailedMessage(string errorMessage, MethodNode method, Frame[] frames, AbstractInsnNode errorLocation) { StringWriter message = new StringWriter(); using (PrintWriter @out = new PrintWriter(message)) { IList <int> localLengths = new List <int>(); IList <int> stackLengths = new List <int>(); foreach (Frame frame in frames) { if (frame != null) { for (int i = 0; i < frame.Locals; i++) { Insert(i, frame.getLocal(i), localLengths); } for (int i = 0; i < frame.StackSize; i++) { Insert(i, frame.getStack(i), stackLengths); } } } Textifier formatted = new Textifier(); TraceMethodVisitor mv = new TraceMethodVisitor(formatted); @out.println(errorMessage); @out.append("\t\tin ").append(method.name).append(method.desc).println(); for (int i = 0; i < method.instructions.size(); i++) { AbstractInsnNode insn = method.instructions.get(i); insn.accept(mv); Frame frame = frames[i]; @out.append("\t\t"); @out.append(insn == errorLocation ? ">>> " : " "); @out.format("%05d [", i); if (frame == null) { //JAVA TO C# CONVERTER WARNING: Unlike Java's ListIterator, enumerators in .NET do not allow altering the collection: Padding(@out, localLengths.GetEnumerator(), '?'); @out.append(" : "); //JAVA TO C# CONVERTER WARNING: Unlike Java's ListIterator, enumerators in .NET do not allow altering the collection: Padding(@out, stackLengths.GetEnumerator(), '?'); } else { Emit(@out, localLengths, frame.getLocal, frame.Locals); Padding(@out, localLengths.listIterator(frame.Locals), '-'); @out.append(" : "); Emit(@out, stackLengths, frame.getStack, frame.StackSize); Padding(@out, stackLengths.listIterator(frame.StackSize), ' '); } @out.print("] : "); @out.print(formatted.text.get(formatted.text.size() - 1)); } for (int j = 0; j < method.tryCatchBlocks.size(); j++) { method.tryCatchBlocks.get(j).accept(mv); @out.print(" " + formatted.text.get(formatted.text.size() - 1)); } } return(message.ToString()); }
public void ComplexGenderAgreement() { SetupWithGerman(); Textifier textifier = new Textifier(eventDB, symbolDB, "de"); Assert.AreEqual("De-N-fem side of de-junction of de-overgrown-plural-neut de-roads", textifier.CreateTextForControl(ControlId(18), "")); }