|
@@ -29,10 +29,10 @@ std::string memory_test_selectItem_1x( |
|
|
auto c = memory_createContext(); |
|
|
auto c = memory_createContext(); |
|
|
c.playfieldSize = 2; |
|
|
c.playfieldSize = 2; |
|
|
c = memory_generateConstPlayfield(c); |
|
|
c = memory_generateConstPlayfield(c); |
|
|
# Select the first item.; |
|
|
|
|
|
|
|
|
// Select the first item. |
|
|
c.selectedId = 0; |
|
|
c.selectedId = 0; |
|
|
c = memory_selectItem(c); |
|
|
c = memory_selectItem(c); |
|
|
# See if it's in selectedItems now.; |
|
|
|
|
|
|
|
|
// See if it's in selectedItems now. |
|
|
if ( |
|
|
if ( |
|
|
c.recentField == "selectedItems" && |
|
|
c.recentField == "selectedItems" && |
|
|
c.selectedItems.size() == 1 && |
|
|
c.selectedItems.size() == 1 && |
|
@@ -50,12 +50,12 @@ std::string memory_test_selectItem_2x( |
|
|
auto c = memory_createContext(); |
|
|
auto c = memory_createContext(); |
|
|
c.playfieldSize = 2; |
|
|
c.playfieldSize = 2; |
|
|
c = memory_generateConstPlayfield(c); |
|
|
c = memory_generateConstPlayfield(c); |
|
|
# Select the first two items.; |
|
|
|
|
|
|
|
|
// Select the first two items. |
|
|
c.selectedId = 0; |
|
|
c.selectedId = 0; |
|
|
c = memory_selectItem(c); |
|
|
c = memory_selectItem(c); |
|
|
c.selectedId = 1; |
|
|
c.selectedId = 1; |
|
|
c = memory_selectItem(c); |
|
|
c = memory_selectItem(c); |
|
|
# See if both items are selected now.; |
|
|
|
|
|
|
|
|
// See if both items are selected now. |
|
|
if ( |
|
|
if ( |
|
|
c.recentField == "selectedItems" && |
|
|
c.recentField == "selectedItems" && |
|
|
c.selectedItems.size() == 2 && |
|
|
c.selectedItems.size() == 2 && |
|
@@ -74,14 +74,14 @@ std::string memory_test_selectItem_3x( |
|
|
auto c = memory_createContext(); |
|
|
auto c = memory_createContext(); |
|
|
c.playfieldSize = 2; |
|
|
c.playfieldSize = 2; |
|
|
c = memory_generateConstPlayfield(c); |
|
|
c = memory_generateConstPlayfield(c); |
|
|
# Select three items.; |
|
|
|
|
|
|
|
|
// Select three items. |
|
|
c.selectedId = 0; |
|
|
c.selectedId = 0; |
|
|
c = memory_selectItem(c); |
|
|
c = memory_selectItem(c); |
|
|
c.selectedId = 1; |
|
|
c.selectedId = 1; |
|
|
c = memory_selectItem(c); |
|
|
c = memory_selectItem(c); |
|
|
c.selectedId = 2; |
|
|
c.selectedId = 2; |
|
|
c = memory_selectItem(c); |
|
|
c = memory_selectItem(c); |
|
|
# See if only one (last) item is selected now.; |
|
|
|
|
|
|
|
|
// See if only one (last) item is selected now. |
|
|
if ( |
|
|
if ( |
|
|
c.recentField == "selectedItems" && |
|
|
c.recentField == "selectedItems" && |
|
|
c.selectedItems.size() == 1 && |
|
|
c.selectedItems.size() == 1 && |
|
@@ -100,14 +100,14 @@ std::string memory_test_shouldDeselectMismatchedItems( |
|
|
auto c = memory_createContext(); |
|
|
auto c = memory_createContext(); |
|
|
c.playfieldSize = 2; |
|
|
c.playfieldSize = 2; |
|
|
c = memory_generateConstPlayfield(c); |
|
|
c = memory_generateConstPlayfield(c); |
|
|
# Select two items of different groups.; |
|
|
|
|
|
|
|
|
// Select two items of different groups. |
|
|
c.selectedId = 0; |
|
|
c.selectedId = 0; |
|
|
c = memory_selectItem(c); |
|
|
c = memory_selectItem(c); |
|
|
c.selectedId = 2; |
|
|
c.selectedId = 2; |
|
|
c = memory_selectItem(c); |
|
|
c = memory_selectItem(c); |
|
|
# Detect mismatching.; |
|
|
|
|
|
|
|
|
// Detect mismatching. |
|
|
c = memory_shouldDeselectMismatchedItems(c); |
|
|
c = memory_shouldDeselectMismatchedItems(c); |
|
|
# See if the two selected items do not match.; |
|
|
|
|
|
|
|
|
// See if the two selected items do not match. |
|
|
if ( |
|
|
if ( |
|
|
c.recentField == "mismatchedItems" && |
|
|
c.recentField == "mismatchedItems" && |
|
|
c.mismatchedItems.size() == 2 && |
|
|
c.mismatchedItems.size() == 2 && |
|
@@ -127,14 +127,14 @@ std::string memory_test_shouldDeselectMismatchedItems_itemTwice( |
|
|
auto c = memory_createContext(); |
|
|
auto c = memory_createContext(); |
|
|
c.playfieldSize = 2; |
|
|
c.playfieldSize = 2; |
|
|
c = memory_generateConstPlayfield(c); |
|
|
c = memory_generateConstPlayfield(c); |
|
|
# Select the same item twice.; |
|
|
|
|
|
|
|
|
// Select the same item twice. |
|
|
c.selectedId = 0; |
|
|
c.selectedId = 0; |
|
|
c = memory_selectItem(c); |
|
|
c = memory_selectItem(c); |
|
|
c.selectedId = 0; |
|
|
c.selectedId = 0; |
|
|
c = memory_selectItem(c); |
|
|
c = memory_selectItem(c); |
|
|
# Detect mismatching.; |
|
|
|
|
|
|
|
|
// Detect mismatching. |
|
|
c = memory_shouldDeselectMismatchedItems(c); |
|
|
c = memory_shouldDeselectMismatchedItems(c); |
|
|
# See if the two selected items do not match.; |
|
|
|
|
|
|
|
|
// See if the two selected items do not match. |
|
|
if ( |
|
|
if ( |
|
|
c.recentField == "mismatchedItems" && |
|
|
c.recentField == "mismatchedItems" && |
|
|
c.mismatchedItems.size() == 1 && |
|
|
c.mismatchedItems.size() == 1 && |
|
@@ -156,23 +156,23 @@ std::string memory_test_shouldDetectVictory( |
|
|
auto c = memory_createContext(); |
|
|
auto c = memory_createContext(); |
|
|
c.playfieldSize = 2; |
|
|
c.playfieldSize = 2; |
|
|
c = memory_generateConstPlayfield(c); |
|
|
c = memory_generateConstPlayfield(c); |
|
|
# Select the first two items of the same group.; |
|
|
|
|
|
|
|
|
// Select the first two items of the same group. |
|
|
c.selectedId = 0; |
|
|
c.selectedId = 0; |
|
|
c = memory_selectItem(c); |
|
|
c = memory_selectItem(c); |
|
|
c.selectedId = 1; |
|
|
c.selectedId = 1; |
|
|
c = memory_selectItem(c); |
|
|
c = memory_selectItem(c); |
|
|
# Hide the first pair.; |
|
|
|
|
|
|
|
|
// Hide the first pair. |
|
|
c = memory_shouldHideMatchingItems(c); |
|
|
c = memory_shouldHideMatchingItems(c); |
|
|
# Select the last two items of the same group.; |
|
|
|
|
|
|
|
|
// Select the last two items of the same group. |
|
|
c.selectedId = 2; |
|
|
c.selectedId = 2; |
|
|
c = memory_selectItem(c); |
|
|
c = memory_selectItem(c); |
|
|
c.selectedId = 3; |
|
|
c.selectedId = 3; |
|
|
c = memory_selectItem(c); |
|
|
c = memory_selectItem(c); |
|
|
# Hide the second pair.; |
|
|
|
|
|
|
|
|
// Hide the second pair. |
|
|
c = memory_shouldHideMatchingItems(c); |
|
|
c = memory_shouldHideMatchingItems(c); |
|
|
# Detect victory.; |
|
|
|
|
|
|
|
|
// Detect victory. |
|
|
c = memory_shouldDetectVictory(c); |
|
|
c = memory_shouldDetectVictory(c); |
|
|
# See if victory has been detected.; |
|
|
|
|
|
|
|
|
// See if victory has been detected. |
|
|
if ( |
|
|
if ( |
|
|
c.recentField == "victory" && |
|
|
c.recentField == "victory" && |
|
|
c.victory == true |
|
|
c.victory == true |
|
@@ -190,14 +190,14 @@ std::string memory_test_shouldHideMatchingItems( |
|
|
auto c = memory_createContext(); |
|
|
auto c = memory_createContext(); |
|
|
c.playfieldSize = 2; |
|
|
c.playfieldSize = 2; |
|
|
c = memory_generateConstPlayfield(c); |
|
|
c = memory_generateConstPlayfield(c); |
|
|
# Select two items of the same group.; |
|
|
|
|
|
|
|
|
// Select two items of the same group. |
|
|
c.selectedId = 0; |
|
|
c.selectedId = 0; |
|
|
c = memory_selectItem(c); |
|
|
c = memory_selectItem(c); |
|
|
c.selectedId = 1; |
|
|
c.selectedId = 1; |
|
|
c = memory_selectItem(c); |
|
|
c = memory_selectItem(c); |
|
|
# Hide matching items.; |
|
|
|
|
|
|
|
|
// Hide matching items. |
|
|
c = memory_shouldHideMatchingItems(c); |
|
|
c = memory_shouldHideMatchingItems(c); |
|
|
# See if the two selected items match.; |
|
|
|
|
|
|
|
|
// See if the two selected items match. |
|
|
if ( |
|
|
if ( |
|
|
c.recentField == "hiddenItems" && |
|
|
c.recentField == "hiddenItems" && |
|
|
c.hiddenItems.size() == 2 && |
|
|
c.hiddenItems.size() == 2 && |
|
|