You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
* Added support for deserializing BgObject types directly into native classes. * Removed opcodes for creating graph structures. These are now created in user code from BgObject types. * Removed BgNodeSpecBuilder. BgNode objects can now be modified directly (returning a modified copy). * Added concrete types for option parameters. The VM now keeps track of any parameters for evaluated options, allowing them to be added into the graph definition. * Order dependencies now take nodes rather than outputs. * Added explicit support for native thunks, whose bindings are saved to a sideband channel during compilation and referenced in bytecode as an index. This generalizes code that was previously specific to node definitions. * Added a name table to bytecode, to optimize situations where we reference the same string mulitple times. #preflight 62bf3c583f0d6beee2e8f4a6 [CL 20918762 by Ben Marsh in ue5-main branch]
60 lines
1.6 KiB
C#
60 lines
1.6 KiB
C#
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Text.Json;
|
|
using OpenTracing;
|
|
using EpicGames.BuildGraph.Expressions;
|
|
using System.Collections.Immutable;
|
|
|
|
namespace EpicGames.BuildGraph.Tests
|
|
{
|
|
[TestClass]
|
|
public class SerializationTests
|
|
{
|
|
class NestedObject
|
|
{
|
|
public int Value { get; set; }
|
|
}
|
|
|
|
class RootObject
|
|
{
|
|
public NestedObject? Nested { get; set; }
|
|
public List<string>? StringList { get; set; }
|
|
public List<NestedObject> NestedList { get; } = new List<NestedObject>();
|
|
}
|
|
|
|
[TestMethod]
|
|
public void BasicTests()
|
|
{
|
|
BgObjectDef def = new BgObjectDef().Set(nameof(RootObject.Nested), new BgObjectDef().Set(nameof(NestedObject.Value), 123));
|
|
RootObject obj = def.Deserialize<RootObject>();
|
|
Assert.AreEqual(123, obj.Nested!.Value);
|
|
}
|
|
|
|
[TestMethod]
|
|
public void StringListTests()
|
|
{
|
|
BgObjectDef def = new BgObjectDef().Set(nameof(RootObject.StringList), new[] { "hello", "world" });
|
|
RootObject obj = def.Deserialize<RootObject>();
|
|
Assert.IsNotNull(obj.StringList);
|
|
Assert.AreEqual(2, obj.StringList!.Count);
|
|
Assert.AreEqual("hello", obj.StringList[0]);
|
|
Assert.AreEqual("world", obj.StringList[1]);
|
|
}
|
|
|
|
[TestMethod]
|
|
public void ObjectListTests()
|
|
{
|
|
BgObjectDef def = new BgObjectDef().Set(nameof(RootObject.NestedList), new[] { new BgObjectDef().Set(nameof(NestedObject.Value), 123) });
|
|
RootObject obj = def.Deserialize<RootObject>();
|
|
Assert.AreEqual(1, obj.NestedList.Count);
|
|
Assert.AreEqual(123, obj.NestedList[0].Value);
|
|
}
|
|
}
|
|
}
|