Пример #1
0
        public void Value1()
        {
            NativeSymbolBag bag = new NativeSymbolBag();

            bag.AddConstant(new NativeConstant("foo", "1"));
            bag.AddConstant(new NativeConstant("bar", "foo+2"));

            Assert.Equal(1, bag.FindUnresolvedNativeValues().Count);
            Assert.True(bag.TryResolveSymbolsAndValues());
        }
Пример #2
0
        public void Value2()
        {
            NativeSymbolBag bag    = new NativeSymbolBag();
            NativeEnum      ntEnum = new NativeEnum("Enum1");

            ntEnum.AddValue("v1", "1");
            ntEnum.AddValue("v2", "v1+1");
            bag.AddDefinedType(ntEnum);
            Assert.Equal(1, bag.FindUnresolvedNativeValues().Count);
            Assert.True(bag.TryResolveSymbolsAndValues());
        }
Пример #3
0
        public void ValueFromStorage1()
        {
            var ns = new BasicSymbolStorage();

            ns.AddConstant(new NativeConstant("c1", "1"));
            var bag = new NativeSymbolBag(ns);

            bag.AddConstant(new NativeConstant("c2", "5+c1"));

            Assert.Equal(1, bag.FindUnresolvedNativeValues().Count);
            Assert.True(bag.TryResolveSymbolsAndValues());
        }
Пример #4
0
        public void Value4()
        {
            NativeSymbolBag bag      = new NativeSymbolBag();
            NativeConstant  ntConst1 = new NativeConstant("c1", "1");

            bag.AddConstant(ntConst1);
            NativeConstant ntConst2 = new NativeConstant("c2", "5+c1");

            bag.AddConstant(ntConst2);

            Assert.Equal(1, bag.FindUnresolvedNativeValues().Count);
            Assert.True(bag.TryResolveSymbolsAndValues());
        }
Пример #5
0
        public void ValueFromStorage3()
        {
            var             ns  = new BasicSymbolStorage();
            NativeSymbolBag bag = new NativeSymbolBag(ns);

            ns.AddDefinedType(new NativeStruct("s1"));

            NativeConstant ntConst1 = new NativeConstant("c1", "(s1)1");

            bag.AddConstant(ntConst1);

            Assert.Equal(1, bag.FindUnresolvedNativeValues().Count);
            Assert.True(bag.TryResolveSymbolsAndValues());
        }
Пример #6
0
        public void Value3()
        {
            NativeSymbolBag bag       = new NativeSymbolBag();
            NativeStruct    ntStruct1 = new NativeStruct("s1");

            bag.AddDefinedType(ntStruct1);

            NativeConstant ntConst1 = new NativeConstant("c1", "(s1)1");

            bag.AddConstant(ntConst1);

            Assert.Equal(1, bag.FindUnresolvedNativeValues().Count);
            Assert.True(bag.TryResolveSymbolsAndValues());
        }
Пример #7
0
        public void ValueFromStorage2()
        {
            var ns  = new BasicSymbolStorage();
            var bag = new NativeSymbolBag(ns);

            NativeEnum ntEnum = new NativeEnum("e1");

            ntEnum.AddValue("v1", "5");
            bag.AddDefinedType(ntEnum);

            NativeConstant ntConst1 = new NativeConstant("c1", "5+v1");

            bag.AddConstant(ntConst1);

            Assert.Equal(1, bag.FindUnresolvedNativeValues().Count);
            Assert.True(bag.TryResolveSymbolsAndValues());
        }