public void Combine() { var st = new StringTable(0); PartialSymbol p1 = PartialSymbol.Create(st, "AAA"); SymbolAtom a1 = SymbolAtom.Create(st, "BBB"); PartialSymbol p2 = p1.Combine(a1); XAssert.AreEqual(@"AAA.BBB", p2.ToString(st)); p1 = PartialSymbol.Create(st, string.Empty); p2 = p1.Combine(a1); XAssert.AreEqual(@"BBB", p2.ToString(st)); p1 = PartialSymbol.Create(st, "AAA"); SymbolAtom a2 = SymbolAtom.Create(st, "CCC"); p2 = p1.Combine(a1, a2); XAssert.AreEqual(@"AAA.BBB.CCC", p2.ToString(st)); p1 = PartialSymbol.Create(st, "AAA"); a2 = SymbolAtom.Create(st, "CCC"); SymbolAtom a3 = SymbolAtom.Create(st, "DDD"); p2 = p1.Combine(a1, a2, a3); XAssert.AreEqual(@"AAA.BBB.CCC.DDD", p2.ToString(st)); PartialSymbol p3 = p1.Combine(p2); XAssert.AreEqual(@"AAA.AAA.BBB.CCC.DDD", p3.ToString(st)); }
public void GetParent() { var st = new StringTable(0); PartialSymbol rp = PartialSymbol.Create(st, @"AAA"); PartialSymbol parent = rp.GetParent(); XAssert.AreEqual(string.Empty, parent.ToString(st)); rp = PartialSymbol.Create(st, @"AAA.BBB"); parent = rp.GetParent(); XAssert.AreEqual(@"AAA", parent.ToString(st)); rp = PartialSymbol.Create(st, @"AAA.BBB.CCC"); parent = rp.GetParent(); XAssert.AreEqual(@"AAA.BBB", parent.ToString(st)); }
public void Conversion() { var st = new StringTable(0); SymbolAtom a1 = SymbolAtom.Create(st, "AAA"); PartialSymbol p1 = PartialSymbol.Create(a1); XAssert.AreEqual("AAA", p1.ToString(st)); }
public void Concat() { var st = new StringTable(0); PartialSymbol rp = PartialSymbol.Create(st, @"AAA.BBB"); SymbolAtom p1 = SymbolAtom.Create(st, "XXX"); PartialSymbol rp2 = rp.Concat(st, p1); XAssert.AreEqual(@"AAA.BBBXXX", rp2.ToString(st)); }
public void ToStringTest() { var st = new StringTable(0); Assert.Throws <NotImplementedException>(() => { PartialSymbol rp = PartialSymbol.Create(st, @"AAA"); #pragma warning disable 618 rp.ToString(); #pragma warning restore 618 }); }
public void IsInitialized() { PartialSymbol p = default(PartialSymbol); XAssert.IsFalse(p.IsValid); var st = new StringTable(0); p = PartialSymbol.Create(st, @"AAA.CCC"); XAssert.AreEqual(@"AAA.CCC", p.ToString(st)); XAssert.IsTrue(p.IsValid); XAssert.IsFalse(p.IsEmpty); p = PartialSymbol.Create(st, string.Empty); XAssert.IsTrue(p.IsValid); XAssert.IsTrue(p.IsEmpty); }