public static void Test03IdDoesNotFlow() { var j = new Job(EnvMode.LegacyJitX64, RunMode.Long); // id will not flow, new Job False(j.HasValue(CharacteristicObject.IdCharacteristic)); False(j.Env.HasValue(CharacteristicObject.IdCharacteristic)); Job.EnvCharacteristic[j] = EnvMode.LegacyJitX86.UnfreezeCopy(); // id will not flow False(j.HasValue(CharacteristicObject.IdCharacteristic)); False(j.Env.HasValue(CharacteristicObject.IdCharacteristic)); var c = new CharacteristicSet(EnvMode.LegacyJitX64, RunMode.Long); // id will not flow, new CharacteristicSet False(c.HasValue(CharacteristicObject.IdCharacteristic)); Job.EnvCharacteristic[c] = EnvMode.LegacyJitX86.UnfreezeCopy(); // id will not flow False(c.HasValue(CharacteristicObject.IdCharacteristic)); CharacteristicObject.IdCharacteristic[c] = "MyId"; // id set explicitly Equal(c.Id, "MyId"); j = new Job("MyId", EnvMode.LegacyJitX64, RunMode.Long); // id set explicitly Equal(j.Id, "MyId"); Equal(j.Env.Id, "MyId"); Job.EnvCharacteristic[j] = EnvMode.LegacyJitX86.UnfreezeCopy(); // id will not flow Equal(j.Id, "MyId"); Equal(j.Env.Id, "MyId"); j = j.With(Jit.RyuJit); // id will not flow False(j.HasValue(CharacteristicObject.IdCharacteristic)); }
public static void Test03IdDoesNotFlow() { var j = new Job(EnvironmentMode.LegacyJitX64, RunMode.Long); // id will not flow, new Job Assert.False(j.HasValue(CharacteristicObject.IdCharacteristic)); Assert.False(j.Environment.HasValue(CharacteristicObject.IdCharacteristic)); Job.EnvironmentCharacteristic[j] = EnvironmentMode.LegacyJitX86.UnfreezeCopy(); // id will not flow Assert.False(j.HasValue(CharacteristicObject.IdCharacteristic)); Assert.False(j.Environment.HasValue(CharacteristicObject.IdCharacteristic)); var c = new CharacteristicSet(EnvironmentMode.LegacyJitX64, RunMode.Long); // id will not flow, new CharacteristicSet Assert.False(c.HasValue(CharacteristicObject.IdCharacteristic)); Job.EnvironmentCharacteristic[c] = EnvironmentMode.LegacyJitX86.UnfreezeCopy(); // id will not flow Assert.False(c.HasValue(CharacteristicObject.IdCharacteristic)); CharacteristicObject.IdCharacteristic[c] = "MyId"; // id set explicitly Assert.Equal("MyId", c.Id); j = new Job("MyId", EnvironmentMode.LegacyJitX64, RunMode.Long); // id set explicitly Assert.Equal("MyId", j.Id); Assert.Equal("MyId", j.Environment.Id); Job.EnvironmentCharacteristic[j] = EnvironmentMode.LegacyJitX86.UnfreezeCopy(); // id will not flow Assert.Equal("MyId", j.Id); Assert.Equal("MyId", j.Environment.Id); j = j.With(Jit.RyuJit); // custom id will flow Assert.Equal("MyId", j.Id); }
public static void Test05ApplyCharacteristicSet() { var set1 = new CharacteristicSet(); var set2 = new CharacteristicSet(); set1 .Apply( new EnvMode { Platform = Platform.X64 }) .Apply( new Job { Run = { LaunchCount = 2 }, Env = { Platform = Platform.X86 } }); AssertProperties(set1, "LaunchCount=2, Platform=X86"); Equal(Job.EnvCharacteristic[set1].Platform, Platform.X86); Equal(set1.HasValue(Job.EnvCharacteristic), true); Equal(EnvMode.PlatformCharacteristic[set1], Platform.X86); set2.Apply(EnvMode.RyuJitX64).Apply(new GcMode { Concurrent = true }); Equal(Job.RunCharacteristic[set2], null); Equal(set2.HasValue(Job.RunCharacteristic), false); AssertProperties(set2, "Concurrent=True, Jit=RyuJit, Platform=X64"); var temp = set1.UnfreezeCopy(); set1.Apply(set2); set2.Apply(temp); AssertProperties(set1, "Concurrent=True, Jit=RyuJit, LaunchCount=2, Platform=X64"); AssertProperties(set2, "Concurrent=True, Jit=RyuJit, LaunchCount=2, Platform=X86"); var j = new Job(); AssertProperties(j, "Default"); j.Env.Gc.Apply(set1); AssertProperties(j, "Concurrent=True"); j.Run.Apply(set1); AssertProperties(j, "Concurrent=True, LaunchCount=2"); j.Env.Apply(set1); AssertProperties(j, "Jit=RyuJit, Platform=X64, Concurrent=True, LaunchCount=2"); j.Apply(set1); AssertProperties(j, "Jit=RyuJit, Platform=X64, Concurrent=True, LaunchCount=2"); }
public static void Test03IdDoesNotFlow() { var j = new Job(EnvMode.LegacyJitX64, RunMode.Long); // id will not flow, new Job False(j.HasValue(JobMode.IdCharacteristic)); False(j.Env.HasValue(JobMode.IdCharacteristic)); Job.EnvCharacteristic[j] = EnvMode.LegacyJitX86.UnfreezeCopy(); // id will not flow False(j.HasValue(JobMode.IdCharacteristic)); False(j.Env.HasValue(JobMode.IdCharacteristic)); var c = new CharacteristicSet(EnvMode.LegacyJitX64, RunMode.Long); // id will not flow, new CharacteristicSet False(c.HasValue(JobMode.IdCharacteristic)); Job.EnvCharacteristic[c] = EnvMode.LegacyJitX86.UnfreezeCopy(); // id will not flow False(c.HasValue(JobMode.IdCharacteristic)); JobMode.IdCharacteristic[c] = "MyId"; // id set explicitly Equal(c.Id, "MyId"); j = new Job("MyId", EnvMode.LegacyJitX64, RunMode.Long); // id set explicitly Equal(j.Id, "MyId"); Equal(j.Env.Id, "MyId"); Job.EnvCharacteristic[j] = EnvMode.LegacyJitX86.UnfreezeCopy(); // id will not flow Equal(j.Id, "MyId"); Equal(j.Env.Id, "MyId"); j = j.With(Jit.RyuJit); // id will not flow False(j.HasValue(JobMode.IdCharacteristic)); }