BGC Tools
Public Member Functions | Private Attributes
BGC.Tests.BagTests Class Reference
Collaboration diagram for BGC.Tests.BagTests:
Collaboration graph
[legend]

Public Member Functions

void PsEmptyTests ()
 
void PullTests ()
 
void PullAutoResetTests ()
 

Private Attributes

readonly List< int > sampleList = new List<int>() { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }
 

Detailed Description

Definition at line 7 of file DepletableBagTests.cs.

Member Function Documentation

◆ PsEmptyTests()

void BGC.Tests.BagTests.PsEmptyTests ( )
inline

Definition at line 12 of file DepletableBagTests.cs.

References BGC.DataStructures.Generic.DepletableBag< T >.Count, and BGC.DataStructures.Generic.DepletableBag< T >.PopNext().

13  {
15  Assert.IsFalse(bag.Count <= 0);
16 
17  for (int i = 0; i < sampleList.Count - 1; ++i)
18  {
19  bag.PopNext();
20  Assert.IsFalse(bag.Count <= 0);
21  }
22 
23  bag.PopNext();
24  Assert.IsTrue(bag.Count <= 0);
25  }
An unstable-sort set structure that acts as a select-without-replace bag.
readonly List< int > sampleList
T PopNext()
Removes and returns the next value in the IDepletable
Here is the call graph for this function:

◆ PullAutoResetTests()

void BGC.Tests.BagTests.PullAutoResetTests ( )
inline

Definition at line 58 of file DepletableBagTests.cs.

References BGC.DataStructures.Generic.DepletableBag< T >.AutoRefill, and BGC.DataStructures.Generic.DepletableBag< T >.PopNext().

59  {
61  bag.AutoRefill = true;
62 
63  for (int i = 0; i < 100; ++i)
64  {
65  Assert.AreNotEqual(default(int), bag.PopNext());
66  }
67  }
An unstable-sort set structure that acts as a select-without-replace bag.
readonly List< int > sampleList
T PopNext()
Removes and returns the next value in the IDepletable
Here is the call graph for this function:

◆ PullTests()

void BGC.Tests.BagTests.PullTests ( )
inline

Definition at line 28 of file DepletableBagTests.cs.

References BGC.DataStructures.Generic.DepletableBag< T >.Add(), BGC.DataStructures.Generic.DepletableBag< T >.Count, and BGC.DataStructures.Generic.DepletableBag< T >.PopNext().

29  {
31  Dictionary<int, bool> dictionary = new Dictionary<int, bool>();
32 
33  for (int i = 0; i < sampleList.Count; ++i)
34  {
35  dictionary.Add(i, false);
36  }
37 
38  while (bag.Count > 0)
39  {
40  dictionary[bag.PopNext()] = true;
41  }
42 
43  for (int i = 0; i < sampleList.Count; ++i)
44  {
45  Assert.IsTrue(dictionary[i + 1]);
46  }
47 
48  for (int i = 0; i < 100; ++i)
49  {
50  if (i >= sampleList.Count)
51  {
52  Assert.AreEqual(default(int), bag.PopNext());
53  }
54  }
55  }
An unstable-sort set structure that acts as a select-without-replace bag.
readonly List< int > sampleList
T PopNext()
Removes and returns the next value in the IDepletable
Here is the call graph for this function:

Field Documentation

◆ sampleList

readonly List<int> BGC.Tests.BagTests.sampleList = new List<int>() { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }
private

Definition at line 9 of file DepletableBagTests.cs.


The documentation for this class was generated from the following file: