public static void unreallisttypereference_is_initiated_as_expected_when_passed_a_list_type_reference_with_a_built_in_type_as_contained_type() { var listTypeRaw = new FieldDefinitionRaw.ListTypeRaw() { valueType = new TypeReferenceRaw() { sourceReference = new SourceReferenceRaw { line = "1", column = "1" }, builtInType = "float", userType = null } }; var containedTypeReference = new UnrealBuiltInTypeReference(listTypeRaw.valueType); var unrealListTypeReference = new UnrealListTypeReference(containedTypeReference); Assert.That(unrealListTypeReference.UnderlyingCapitalisedName == "Float"); Assert.That(unrealListTypeReference.RequiredIncludes.Count == 1); Assert.That(unrealListTypeReference.RequiredIncludes.Contains("\"FloatList.h\"")); Assert.That(unrealListTypeReference.UnderlyingQualifiedName == "float"); Assert.That(unrealListTypeReference.UnrealType == "UFloatList*"); Assert.That(unrealListTypeReference.AssignUnderlyingValueToUnrealMemberVariable("TestField", "val") == "if (TestField == nullptr) { TestField = NewObject<UFloatList>(this); } TestField->Init(val)"); Assert.That(unrealListTypeReference.ConvertUnderlyingValueToUnrealLocalVariable("val") == "NewObject<UFloatList>()->Init(val)"); Assert.That(unrealListTypeReference.ConvertUnderlyingValueToUnrealMemberVariable("val") == "NewObject<UFloatList>(this)->Init(val)"); Assert.That(unrealListTypeReference.ConvertUnrealValueToSnapshotValue("val") == "val->GetUnderlying()"); Assert.That(unrealListTypeReference.ConvertUnrealValueToUnderlyingValue("val") == "val->GetUnderlying()"); Assert.That(unrealListTypeReference.DefaultInitialisationString == "worker::List<float>()"); Assert.That(unrealListTypeReference.SnapshotType == "worker::List<float>"); }
public static void unreallisttypereference_is_initiated_as_expected_when_passed_a_list_type_reference_with_an_enum_type_as_contained_type() { var userEnumDefinition = GenerateEnumDefinition(); var unrealEnumDetails = new UnrealEnumDetails(userEnumDefinition, "TestEnum", null); var containedEnumReference = new UnrealEnumTypeReference(unrealEnumDetails); var unrealEnumTypeReference = new UnrealListTypeReference(containedEnumReference); Assert.That(unrealEnumTypeReference.UnderlyingCapitalisedName == "ImprobableCodegenTestEnum"); Assert.That(unrealEnumTypeReference.RequiredIncludes.Count == 2); Assert.That(unrealEnumTypeReference.RequiredIncludes.Contains("\"ImprobableCodegenTestEnumList.h\"")); Assert.That(unrealEnumTypeReference.RequiredIncludes.Contains("\"TestEnum.h\"")); Assert.That(unrealEnumTypeReference.UnderlyingQualifiedName == "improbable::codegen::TestEnum"); Assert.That(unrealEnumTypeReference.UnrealType == "UImprobableCodegenTestEnumList*"); Assert.That(unrealEnumTypeReference.AssignUnderlyingValueToUnrealMemberVariable("TestField", "val") == "if (TestField == nullptr) { TestField = NewObject<UImprobableCodegenTestEnumList>(this); } TestField->Init(val)"); Assert.That(unrealEnumTypeReference.ConvertUnderlyingValueToUnrealLocalVariable("val") == "NewObject<UImprobableCodegenTestEnumList>()->Init(val)"); Assert.That(unrealEnumTypeReference.ConvertUnderlyingValueToUnrealMemberVariable("val") == "NewObject<UImprobableCodegenTestEnumList>(this)->Init(val)"); Assert.That(unrealEnumTypeReference.ConvertUnrealValueToUnderlyingValue("val") == "val->GetUnderlying()"); }