예제 #1
0
        public void StrFldMerger_FindOverlappingCluster()
        {
            StructureType str = new StructureType("foo", 0);

            str.Fields.Add(2, PrimitiveType.Word32);
            str.Fields.Add(4, PrimitiveType.Word32);
            foreach (List <StructureField> cluster in sfm.GetOverlappingClusters(str.Fields))
            {
                Assert.AreEqual(2, cluster.Count);
            }
        }
예제 #2
0
        public void StrFldMerger_FindOverLappingClusterWithEqv()
        {
            StructureType    str = new StructureType("foo", 0);
            UnionType        u   = new UnionType(null, null, PrimitiveType.Ptr32, PrimitiveType.Word16);
            EquivalenceClass eq  = Eqv(u);

            str.Fields.Add(2, eq);
            str.Fields.Add(4, PrimitiveType.SegmentSelector);

            var sfm = new StructureFieldMerger(str);
            IEnumerable <List <StructureField> > eb = sfm.GetOverlappingClusters(str.Fields);
            IEnumerator <List <StructureField> > e  = eb.GetEnumerator();

            Assert.IsTrue(e.MoveNext());
            Assert.AreEqual(3, e.Current.Count);
            List <StructureField> cluster = e.Current;
        }