Пример #1
0
        static WrapperProvider()
        {
            frc = new FieldReferenceComparer();
            TypeDefinitionComparer tdc = new TypeDefinitionComparer();
            InstructionComparer    idc = new InstructionComparer();
            VariableComparer       vc  = new VariableComparer();

            MethRefToWrapperMap  = new Dictionary <IMethodReference, MethodRefWrapper>(MethodReferenceDefinitionComparer.Default);
            TypeRefToWrapperMap  = new Dictionary <ITypeReference, TypeRefWrapper>(tdc);
            FieldRefToWrapperMap = new Dictionary <IFieldReference, FieldRefWrapper>(frc);
            InstToWrapperMap     = new Dictionary <Instruction, InstructionWrapper>(new InstructionComparer());
            VarToWrapperMap      = new Dictionary <IVariable, VariableWrapper>(vc);

            MethRefToAddrWrapperMap    = new Dictionary <IMethodReference, AddressWrapper>(MethodReferenceDefinitionComparer.Default);
            InstFldRefToAddrWrapperMap = new Dictionary <Instruction, IDictionary <IFieldReference, AddressWrapper> >(idc);
            FieldRefToAddrWrapperMap   = new Dictionary <IFieldReference, AddressWrapper>(frc);
            VarToAddrWrapperMap        = new Dictionary <IVariable, AddressWrapper>(vc);
            ArrayToAddrWrapperMap      = new Dictionary <Instruction, AddressWrapper>(idc);

            InstToHeapElemWrapperMap       = new Dictionary <Instruction, HeapElemWrapper>(idc);
            InstToHeapArrayElemWrapperMap  = new Dictionary <Instruction, HeapElemWrapper>(idc);
            VarToHeapElemWrapperMap        = new Dictionary <IVariable, HeapElemWrapper>(vc);
            FieldRefToHeapElemWrapperMap   = new Dictionary <IFieldReference, HeapElemWrapper>(frc);
            InstFldRefToHeapElemWrapperMap = new Dictionary <Instruction, IDictionary <IFieldReference, HeapElemWrapper> >(idc);

            InstToExHandlerWrapperMap = new Dictionary <Instruction, ExHandlerWrapper>(idc);
        }
Пример #2
0
        public void Day07_ParseDataToRulesList_ok()
        {
            string datapath = "day07.txt";

            InstructionComparer sut = new InstructionComparer(datapath);

            foreach (var step in sut.Steps)
            {
                Debug.WriteLine($"Step: {step}");
            }
            Assert.Equal(26, sut.Steps.Count);
            Assert.Equal(101, sut.Rules.Count);
            sut.Steps.Sort(sut.CompareRules);
            foreach (var step in sut.Steps)
            {
                Debug.WriteLine($"Sorted step: {step}");
            }
            string expected = "ACDFKBENQTHJMOWIZULPRSXVGY";

            string[] actualArr = sut.Steps.ToArray();
            string   actual    = string.Join("", actualArr);

            Assert.Equal(expected, actual);
        }