/// <summary> ///Add 的测试 ///</summary> public void AddTestHelper <KeyT>() { SafeHashSet <KeyT> target = new SafeHashSet <KeyT>(); // TODO: 初始化为适当的值 KeyT key = default(KeyT); // TODO: 初始化为适当的值 target.Add(key); Assert.Inconclusive("无法验证不返回值的方法。"); }
/// <summary> ///Remove 的测试 ///</summary> public void RemoveTestHelper <KeyT, ValueT>() { LockFreeDictionary <KeyT, ValueT> target = new LockFreeDictionary <KeyT, ValueT>(); // TODO: 初始化为适当的值 KeyT key = default(KeyT); // TODO: 初始化为适当的值 target.Remove(key); Assert.Inconclusive("无法验证不返回值的方法。"); }
/// <summary> ///Add 的测试 ///</summary> public void AddTestHelper <KeyT, ValueT>() { SafeMultiDictionary <KeyT, ValueT> target = new SafeMultiDictionary <KeyT, ValueT>(); // TODO: 初始化为适当的值 KeyT key = default(KeyT); // TODO: 初始化为适当的值 ValueT value = default(ValueT); // TODO: 初始化为适当的值 target.Add(key, value); Assert.Inconclusive("无法验证不返回值的方法。"); }
/// <summary> ///ClearValues 的测试 ///</summary> public void ClearValuesTestHelper <KeyT, ValueT>() { bool allowDuplicateValues = false; // TODO: 初始化为适当的值 MultiDictionary <KeyT, ValueT> target = new MultiDictionary <KeyT, ValueT>(allowDuplicateValues); // TODO: 初始化为适当的值 KeyT key = default(KeyT); // TODO: 初始化为适当的值 target.ClearValues(key); Assert.Inconclusive("无法验证不返回值的方法。"); }
/// <summary> ///AddMany 的测试 ///</summary> public void AddManyTestHelper <KeyT, ValueT>() { SafeMultiDictionary <KeyT, ValueT> target = new SafeMultiDictionary <KeyT, ValueT>(); // TODO: 初始化为适当的值 KeyT key = default(KeyT); // TODO: 初始化为适当的值 IEnumerable <ValueT> values = null; // TODO: 初始化为适当的值 target.AddMany(key, values); Assert.Inconclusive("无法验证不返回值的方法。"); }
/// <summary> ///Add 的测试 ///</summary> public void AddTest1Helper <KeyT, ValueT>() { bool allowDuplicateValues = false; // TODO: 初始化为适当的值 MultiDictionary <KeyT, ValueT> target = new MultiDictionary <KeyT, ValueT>(allowDuplicateValues); // TODO: 初始化为适当的值 KeyT key = default(KeyT); // TODO: 初始化为适当的值 ValueT value = default(ValueT); // TODO: 初始化为适当的值 target.Add(key, value); Assert.Inconclusive("无法验证不返回值的方法。"); }
internal LockDictReleaser(KeyT name, AsyncLockWithWaiterCount lockEntry, IDisposable lockHandle, AsyncLockQueueDictionary <KeyT> asyncLockQueueDictionary) #endif { this.Name = name; this.LockEntry = lockEntry; #if !NOASYNC this.LockHandle = lockHandle; #endif this.AsyncLockQueueDictionary = asyncLockQueueDictionary; }
/// <summary> ///ContainsKey 的测试 ///</summary> public void ContainsKeyTestHelper <KeyT, ValueT>() { LockFreeDictionary <KeyT, ValueT> target = new LockFreeDictionary <KeyT, ValueT>(); // TODO: 初始化为适当的值 KeyT key = default(KeyT); // TODO: 初始化为适当的值 bool expected = false; // TODO: 初始化为适当的值 bool actual; actual = target.ContainsKey(key); Assert.AreEqual(expected, actual); Assert.Inconclusive("验证此测试方法的正确性。"); }
/// <summary> ///GetValue 的测试 ///</summary> public void GetValueTestHelper <KeyT, ValueT>() { LockFreeDictionary <KeyT, ValueT> target = new LockFreeDictionary <KeyT, ValueT>(); // TODO: 初始化为适当的值 KeyT key = default(KeyT); // TODO: 初始化为适当的值 ValueT expected = default(ValueT); // TODO: 初始化为适当的值 ValueT actual; actual = target.GetValue(key); Assert.AreEqual(expected, actual); Assert.Inconclusive("验证此测试方法的正确性。"); }
/// <summary> ///ToArrayValuesByKey 的测试 ///</summary> public void ToArrayValuesByKeyTestHelper <KeyT, ValueT>() { SafeMultiDictionary <KeyT, ValueT> target = new SafeMultiDictionary <KeyT, ValueT>(); // TODO: 初始化为适当的值 KeyT key = default(KeyT); // TODO: 初始化为适当的值 ValueT[] expected = null; // TODO: 初始化为适当的值 ValueT[] actual; actual = target.ToArrayValuesByKey(key); Assert.AreEqual(expected, actual); Assert.Inconclusive("验证此测试方法的正确性。"); }
/// <summary> ///GetValues 的测试 ///</summary> public void GetValuesTestHelper <KeyT, ValueT>() { SafeMultiDictionary <KeyT, ValueT> target = new SafeMultiDictionary <KeyT, ValueT>(); // TODO: 初始化为适当的值 KeyT key = default(KeyT); // TODO: 初始化为适当的值 IEnumerable <ValueT> expected = null; // TODO: 初始化为适当的值 IEnumerable <ValueT> actual; actual = target.GetValues(key); Assert.AreEqual(expected, actual); Assert.Inconclusive("验证此测试方法的正确性。"); }
/// <summary> ///Contains 的测试 ///</summary> public void ContainsTestHelper <KeyT>() { SafeHashSet <KeyT> target = new SafeHashSet <KeyT>(); // TODO: 初始化为适当的值 KeyT key = default(KeyT); // TODO: 初始化为适当的值 bool expected = false; // TODO: 初始化为适当的值 bool actual; actual = target.Contains(key); Assert.AreEqual(expected, actual); Assert.Inconclusive("验证此测试方法的正确性。"); }
/// <summary> ///Remove 的测试 ///</summary> public void RemoveTestHelper <KeyT, ValueT>() { SafeMultiDictionary <KeyT, ValueT> target = new SafeMultiDictionary <KeyT, ValueT>(); // TODO: 初始化为适当的值 KeyT key = default(KeyT); // TODO: 初始化为适当的值 bool expected = false; // TODO: 初始化为适当的值 bool actual; actual = target.Remove(key); Assert.AreEqual(expected, actual); Assert.Inconclusive("验证此测试方法的正确性。"); }
/// <summary> ///CountValues 的测试 ///</summary> public void CountValuesTestHelper <KeyT, ValueT>() { bool allowDuplicateValues = false; // TODO: 初始化为适当的值 MultiDictionary <KeyT, ValueT> target = new MultiDictionary <KeyT, ValueT>(allowDuplicateValues); // TODO: 初始化为适当的值 KeyT key = default(KeyT); // TODO: 初始化为适当的值 int expected = 0; // TODO: 初始化为适当的值 int actual; actual = target.CountValues(key); Assert.AreEqual(expected, actual); Assert.Inconclusive("验证此测试方法的正确性。"); }
// //编写测试时,还可使用以下属性: // //使用 ClassInitialize 在运行类中的第一个测试前先运行代码 //[ClassInitialize()] //public static void MyClassInitialize(TestContext testContext) //{ //} // //使用 ClassCleanup 在运行完类中的所有测试后再运行代码 //[ClassCleanup()] //public static void MyClassCleanup() //{ //} // //使用 TestInitialize 在运行每个测试前先运行代码 //[TestInitialize()] //public void MyTestInitialize() //{ //} // //使用 TestCleanup 在运行完每个测试后运行代码 //[TestCleanup()] //public void MyTestCleanup() //{ //} // #endregion /// <summary> ///Item 的测试 ///</summary> public void ItemTestHelper <KeyT, ValueT>() { SafeDictionary <KeyT, ValueT> target = new SafeDictionary <KeyT, ValueT>(); // TODO: 初始化为适当的值 KeyT key = default(KeyT); // TODO: 初始化为适当的值 ValueT expected = default(ValueT); // TODO: 初始化为适当的值 ValueT actual; target[key] = expected; actual = target[key]; Assert.AreEqual(expected, actual); Assert.Inconclusive("验证此测试方法的正确性。"); }
/// <summary> ///Item 的测试 ///</summary> public void ItemTestHelper <KeyT, ValueT>() { LockFreeMultiDictionary <KeyT, ValueT> target = new LockFreeMultiDictionary <KeyT, ValueT>(); // TODO: 初始化为适当的值 KeyT key = default(KeyT); // TODO: 初始化为适当的值 IEnumerable <ValueT> expected = null; // TODO: 初始化为适当的值 IEnumerable <ValueT> actual; target[key] = expected; actual = target[key]; Assert.AreEqual(expected, actual); Assert.Inconclusive("验证此测试方法的正确性。"); }
/// <summary> ///RemoveMany 的测试 ///</summary> public void RemoveManyTest1Helper <KeyT, ValueT>() { bool allowDuplicateValues = false; // TODO: 初始化为适当的值 MultiDictionary <KeyT, ValueT> target = new MultiDictionary <KeyT, ValueT>(allowDuplicateValues); // TODO: 初始化为适当的值 KeyT key = default(KeyT); // TODO: 初始化为适当的值 IEnumerable <ValueT> values = null; // TODO: 初始化为适当的值 int expected = 0; // TODO: 初始化为适当的值 int actual; actual = target.RemoveMany(key, values); Assert.AreEqual(expected, actual); Assert.Inconclusive("验证此测试方法的正确性。"); }
/// <summary> ///Item 的测试 ///</summary> public void ItemTestHelper <KeyT, ValueT>() { bool allowDuplicateValues = false; // TODO: 初始化为适当的值 MultiDictionary <KeyT, ValueT> target = new MultiDictionary <KeyT, ValueT>(allowDuplicateValues); // TODO: 初始化为适当的值 KeyT key = default(KeyT); // TODO: 初始化为适当的值 ICollection <ValueT> expected = null; // TODO: 初始化为适当的值 ICollection <ValueT> actual; target[key] = expected; actual = target[key]; Assert.AreEqual(expected, actual); Assert.Inconclusive("验证此测试方法的正确性。"); }
public Node getChildNode(KeyT character) { Node childNode; if (childMap.TryGetValue(character, out childNode)) { return(childNode); } else { return(null); } }
/// <summary> ///Remove 的测试 ///</summary> public void RemoveTestHelper <KeyT, ValueT>() { bool allowDuplicateValues = false; // TODO: 初始化为适当的值 MultiDictionary <KeyT, ValueT> target = new MultiDictionary <KeyT, ValueT>(allowDuplicateValues); // TODO: 初始化为适当的值 KeyT key = default(KeyT); // TODO: 初始化为适当的值 ValueT value = default(ValueT); // TODO: 初始化为适当的值 bool expected = false; // TODO: 初始化为适当的值 bool actual; actual = target.Remove(key, value); Assert.AreEqual(expected, actual); Assert.Inconclusive("验证此测试方法的正确性。"); }
/// <summary> ///TryGetValue 的测试 ///</summary> public void TryGetValueTestHelper <KeyT, ValueT>() { LockFreeDictionary <KeyT, ValueT> target = new LockFreeDictionary <KeyT, ValueT>(); // TODO: 初始化为适当的值 KeyT key = default(KeyT); // TODO: 初始化为适当的值 ValueT value = default(ValueT); // TODO: 初始化为适当的值 ValueT valueExpected = default(ValueT); // TODO: 初始化为适当的值 bool expected = false; // TODO: 初始化为适当的值 bool actual; actual = target.TryGetValue(key, out value); Assert.AreEqual(valueExpected, value); Assert.AreEqual(expected, actual); Assert.Inconclusive("验证此测试方法的正确性。"); }
/// <summary> ///TryGetValues 的测试 ///</summary> public void TryGetValuesTestHelper <KeyT, ValueT>() { SafeMultiDictionary <KeyT, ValueT> target = new SafeMultiDictionary <KeyT, ValueT>(); // TODO: 初始化为适当的值 KeyT key = default(KeyT); // TODO: 初始化为适当的值 IEnumerable <ValueT> values = null; // TODO: 初始化为适当的值 IEnumerable <ValueT> valuesExpected = null; // TODO: 初始化为适当的值 bool expected = false; // TODO: 初始化为适当的值 bool actual; actual = target.TryGetValues(key, out values); Assert.AreEqual(valuesExpected, values); Assert.AreEqual(expected, actual); Assert.Inconclusive("验证此测试方法的正确性。"); }
/// <summary> /// Finds an equivalent 6-hand states or creates a new one. ///For 6-hands the equality of the keys does not guarantee the equality of /// the states. Therefore we have to do special processing and compare /// states with equal key. To do this.compare states with the same keys, /// we will compare the transition tables. /// </summary> State CreateOrFind6State(CardSet cards, KeyT key) { List <State> list; State state = new State(); FillFinalHands(state, cards); if (!_dict6.TryGetValue(key, out list)) { // The very first state for this key, no doubts we have to add it. AddState(key, state); return(state); } foreach (State eqCandidate in list) { bool areEqual = true; for (int i = 0; i < 52; ++i) { if (eqCandidate.Table[i] != state.Table[i]) { if (eqCandidate.Table[i] == 0 || state.Table[i] == 0) { // Ignore difference if one of the elements is not initialized. continue; } areEqual = false; break; } } if (areEqual) { // Great, an equivalent state is found, return it. return(eqCandidate); } } // No equivalent is found - add this state. AddState(key, state); return(state); }
void OnCombinCreateStates(CardSet cards, int count) { _cardsToState[count][_combinCount].Cards = cards; KeyT key = new KeyT(count, _maxHandSize, cards); State state; if (key.HandSize < 6) { if (!_dict.TryGetValue(key, out state)) { state = new State(); AddState(key, state); } } else { state = CreateOrFind6State(cards, key); } _cardsToState[count][_combinCount].StateId = state.Id; _combinCount++; }
private void AddState(KeyT key, State state) { state.Key = key; state.Id = _states.Count; _states.Add(state); if (state.Key.HandSize < 6) { _dict.Add(key, state); } else { List <State> list; if (!_dict6.TryGetValue(key, out list)) { list = new List <State>(); _dict6.Add(key, list); } list.Add(state); } if (_states.Count % 50000 == 0) { Console.WriteLine("{0:#,#} states created", _states.Count); } }
public Node(KeyT character) { this.character = character; value = null; }
public void setChildNode(KeyT character, Node childNode) { childMap.Add(character, childNode); childNode.parent = this; }
public Node(KeyT character, ValT value) { this.character = character; this.value = value; }
internal LockDictReleaser(KeyT name, AsyncLockWithWaiterCount lockEntry, AsyncLockQueueDictionary <KeyT> asyncLockQueueDictionary)