|
|
@@ -0,0 +1,35 @@ |
|
|
|
#include <map> |
|
|
|
#include <string> |
|
|
|
|
|
|
|
std::map<int, int> memory_generateConstPlayfield( |
|
|
|
int n |
|
|
|
) { |
|
|
|
std::map<int, int> idGroups; |
|
|
|
auto id = 0; |
|
|
|
for (auto gid = 0; gid < n; ++gid) { |
|
|
|
idGroups[id] = gid; |
|
|
|
id += 1; |
|
|
|
idGroups[id] = gid; |
|
|
|
id += 1; |
|
|
|
} |
|
|
|
return idGroups; |
|
|
|
} |
|
|
|
|
|
|
|
std::string test_memory_generateConstPlayfield() { |
|
|
|
auto idGroups = memory_generateConstPlayfield(2); |
|
|
|
if ( |
|
|
|
idGroups.size() == 4 && |
|
|
|
idGroups[0] == 0 && |
|
|
|
idGroups[1] == 0 && |
|
|
|
idGroups[2] == 1 && |
|
|
|
idGroups[3] == 1 |
|
|
|
) { |
|
|
|
return "OK: memory_generateConstPlayfield"; |
|
|
|
} |
|
|
|
|
|
|
|
return "ERR: memory_generateConstPlayfield"; |
|
|
|
} |
|
|
|
|
|
|
|
int main() { |
|
|
|
printf("%s\n", test_memory_generateConstPlayfield().c_str()); |
|
|
|
} |