当前位置: 首页>>代码示例>>C#>>正文


C# ErlAtom.Visit方法代码示例

本文整理汇总了C#中ErlAtom.Visit方法的典型用法代码示例。如果您正苦于以下问题:C# ErlAtom.Visit方法的具体用法?C# ErlAtom.Visit怎么用?C# ErlAtom.Visit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ErlAtom的用法示例。


在下文中一共展示了ErlAtom.Visit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ErlAtomTest

    public void ErlAtomTest()
    {
      var am_test = new ErlAtom("test");
      Assert.IsTrue(am_test.Equals(new ErlAtom("test")));
      Assert.AreEqual(am_test, new ErlAtom("test"));
      Assert.AreEqual("test", am_test.Value);
      Assert.AreEqual("test", am_test.ToString());
      Assert.IsTrue(am_test.IsScalar);
      Assert.AreEqual(ErlTypeOrder.ErlAtom, am_test.TypeOrder);

      Assert.IsTrue(am_test.Matches(new ErlAtom("test")));
      Assert.AreEqual(new ErlVarBind(), am_test.Match(new ErlAtom("test")));

      var am_Test = new ErlAtom("Test");
      Assert.AreEqual("'Test'", am_Test.ToString());
      Assert.AreEqual(4, am_Test.Length);
      Assert.AreNotEqual(am_test, am_Test);

      IErlObject temp = null;
      Assert.IsFalse(am_test.Subst(ref temp, new ErlVarBind()));

      Assert.IsTrue(am_Test.Visit(true, (acc, o) => acc));

      Assert.DoesNotThrow(() => { var x = am_test.ValueAsObject; });
      Assert.Throws<ErlIncompatibleTypesException>(() => { var x = am_test.ValueAsInt; });
      Assert.Throws<ErlIncompatibleTypesException>(() => { var x = am_test.ValueAsLong; });
      Assert.Throws<ErlIncompatibleTypesException>(() => { var x = am_test.ValueAsDecimal; });
      Assert.Throws<ErlIncompatibleTypesException>(() => { var x = am_test.ValueAsDateTime; });
      Assert.Throws<ErlIncompatibleTypesException>(() => { var x = am_test.ValueAsTimeSpan; });
      Assert.Throws<ErlIncompatibleTypesException>(() => { var x = am_test.ValueAsDouble; });
      Assert.DoesNotThrow(() => { var x = am_test.ValueAsString; });
      Assert.DoesNotThrow(() => { var x = am_test.ValueAsBool; });
      Assert.AreEqual('a', new ErlAtom("a").ValueAsChar);
      Assert.Throws<ErlIncompatibleTypesException>(() => { var x = am_test.ValueAsByteArray; });

      string s = am_test;  // Implicit conversion
      Assert.AreEqual("test", s);

      ErlAtom a = "abc";   // Implicit conversion
      Assert.AreEqual("abc", a.Value);
    }
开发者ID:keck,项目名称:nfx,代码行数:41,代码来源:ErlTermTest.cs


注:本文中的ErlAtom.Visit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。