public void DictionaryTest() { string expect = "#hash((a1 . 1) (a2 . 2) (\"b1\" . \"1\") (\"b2\" . 2.2))"; Symbol a1 = Symbol.Intern("a1"); Symbol a2 = Symbol.Intern("a2"); string b1 = "b1"; string b2 = "b2"; Dictionary <object, Value> table1 = ValueDictionary.FromArguments(a1, 1, a2, 2, b1, "1", b2, 2.2); Value t1 = new Value(table1); Assert.AreEqual(expect, ValueString.ToString(table1)); Assert.AreEqual(expect, t1.ToString()); }
public void DictionaryTest() { Symbol a1 = Symbol.Intern("a1"); Symbol a2 = Symbol.Intern("a2"); Symbol b1 = Symbol.Intern("b1"); Symbol b2 = Symbol.Intern("b2"); Dictionary <object, Value> table1 = ValueDictionary.FromArguments(a1, 1, a2, 2, b1, 1, b2, 2); Dictionary <object, Value> table2 = ValueDictionary.FromArguments(a1, 1, a2, 2, b1, 1, b2, 2); Dictionary <object, Value> table3 = ValueDictionary.FromArguments(a1, 0, a2, 2, b1, 1, b2, 2); Assert.AreEqual(1, (int)table1[a1]); Assert.AreEqual(2, (int)table1[a2]); Assert.AreEqual(table1[a1], table1[b1]); Assert.AreEqual(table1[a2], table1[b2]); Assert.AreNotEqual(2, (int)table1[a1]); Assert.AreNotEqual(1, (int)table1[a2]); Assert.AreNotEqual(table1[a1], table1[b2]); Assert.AreNotEqual(table1[a2], table1[a1]); Assert.AreEqual(table1, table2); Assert.AreNotEqual(table1, table3); }