public void GetAllInheritedTypesListCloserBaseClassesFirst() { // Class hierarchy: // // 111 211 121 221 // \ / \ / // 011 021 // \ / // 001 var type_001 = new SbTypeStub("type_001", TypeFlags.NONE); var type_011 = new SbTypeStub("type_011", TypeFlags.NONE); var type_021 = new SbTypeStub("type_021", TypeFlags.NONE); var type_111 = new SbTypeStub("type_111", TypeFlags.NONE); var type_211 = new SbTypeStub("type_211", TypeFlags.NONE); var type_121 = new SbTypeStub("type_121", TypeFlags.NONE); var type_221 = new SbTypeStub("type_221", TypeFlags.NONE); type_001.AddDirectBaseClass(type_011); type_001.AddDirectBaseClass(type_021); type_011.AddDirectBaseClass(type_111); type_011.AddDirectBaseClass(type_211); type_021.AddDirectBaseClass(type_121); type_021.AddDirectBaseClass(type_221); var remoteValue = new RemoteValueFake("leafVar", "leafValue"); remoteValue.SetTypeInfo(type_001); var varInfo = CreateVarInfo(remoteValue, "dummyDisplayName"); var inheritedTypes = varInfo.GetAllInheritedTypes().ToList(); Func <string, int> indexOf = typeName => inheritedTypes.IndexOf(typeName); Assert.That(inheritedTypes.Count, Is.EqualTo(7)); Assert.That(indexOf("type_111"), Is.GreaterThan(indexOf("type_011"))); Assert.That(indexOf("type_111"), Is.GreaterThan(indexOf("type_021"))); Assert.That(indexOf("type_111"), Is.GreaterThan(indexOf("type_001"))); Assert.That(indexOf("type_211"), Is.GreaterThan(indexOf("type_011"))); Assert.That(indexOf("type_211"), Is.GreaterThan(indexOf("type_021"))); Assert.That(indexOf("type_211"), Is.GreaterThan(indexOf("type_001"))); Assert.That(indexOf("type_121"), Is.GreaterThan(indexOf("type_011"))); Assert.That(indexOf("type_121"), Is.GreaterThan(indexOf("type_021"))); Assert.That(indexOf("type_121"), Is.GreaterThan(indexOf("type_001"))); Assert.That(indexOf("type_221"), Is.GreaterThan(indexOf("type_011"))); Assert.That(indexOf("type_221"), Is.GreaterThan(indexOf("type_021"))); Assert.That(indexOf("type_221"), Is.GreaterThan(indexOf("type_001"))); Assert.That(indexOf("type_011"), Is.GreaterThan(indexOf("type_001"))); Assert.That(indexOf("type_021"), Is.GreaterThan(indexOf("type_001"))); }
public void SetUp() { logSpy = new LogSpy(); logSpy.Attach(); childValues = new int[] { 20, 21, 22, 23, 24 }; remoteValue = RemoteValueFakeUtil.CreateSimpleIntArray("myArray", childValues); ulong elementSize = 4; var pointeeType = new SbTypeStub("int", TypeFlags.IS_INTEGER); pointeeType.SetByteSize(elementSize); var pointerType = new SbTypeStub("int*", TypeFlags.IS_POINTER, pointeeType); ulong address = 1234; pointerValue = RemoteValueFakeUtil.CreatePointer("int*", "myPtr", $"{address}"); pointerValue.SetTypeInfo(pointerType); for (uint i = 0; i < 5; i++) { pointerValue.SetCreateValueFromAddress( address + i * elementSize, RemoteValueFakeUtil.CreateSimpleInt($"[{i}]", (int)(i) + 20)); } }
public void CanonicalBoolTypeValues(bool value) { var remoteValue = new RemoteValueFake("myVar", value ? "true" : "false"); var boolType = new SbTypeStub("MyBoolType", TypeFlags.IS_TYPEDEF); boolType.SetCanonicalType(new SbTypeStub("bool", TypeFlags.IS_SCALAR)); remoteValue.SetTypeInfo(boolType); var varInfo = varInfoBuilder.Create(remoteValue); Assert.That(varInfo.IsTruthy, Is.EqualTo(value)); }
public void GetAllInheritedTypesWithOneBaseClass() { var baseType = new SbTypeStub("BaseType", TypeFlags.NONE); var derivedType = new SbTypeStub("DerivedType", TypeFlags.NONE); derivedType.AddDirectBaseClass(baseType); var derivedVar = new RemoteValueFake("derivedVar", "derivedValue"); derivedVar.SetTypeInfo(derivedType); var varInfo = CreateVarInfo(derivedVar, "dummyDisplayName"); var inheritedTypes = varInfo.GetAllInheritedTypes(); Assert.That(inheritedTypes, Is.EqualTo(new[] { "DerivedType", "BaseType" })); }
public void SetUp() { _compRoot = new MediumTestDebugEngineFactoryCompRoot(new JoinableTaskContext()); _childValues = new int[] { 20, 21, 22, 23, 24 }; _remoteValue = RemoteValueFakeUtil.CreateSimpleIntArray("myArray", _childValues); ulong elementSize = 4; var pointeeType = new SbTypeStub("int", TypeFlags.IS_INTEGER); pointeeType.SetByteSize(elementSize); var pointerType = new SbTypeStub("int*", TypeFlags.IS_POINTER, pointeeType); _pointerValue = RemoteValueFakeUtil.CreatePointer("int*", "myPtr", $"{_pointerAddress}"); _pointerValue.SetTypeInfo(pointerType); for (uint i = 0; i < 5; i++) { _pointerValue.SetCreateValueFromAddress( _pointerAddress + i * elementSize, RemoteValueFakeUtil.CreateSimpleInt($"[{i}]", (int)(i) + 20)); } }