d
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
#include <map>
|
||||
#include "Memory.h"
|
||||
|
||||
std::map<int, int> memory_generateConstPlayfield(int n) {
|
||||
std::map<int, int> idGroups;
|
||||
int id = 0;
|
||||
for (int gid = 0; gid < n; ++gid) {
|
||||
idGroups[id++] = gid;
|
||||
idGroups[id++] = gid;
|
||||
}
|
||||
return idGroups;
|
||||
}
|
||||
|
||||
17
language-C++/Memory/src/Memory.Test.cpp
Normal file
17
language-C++/Memory/src/Memory.Test.cpp
Normal file
@@ -0,0 +1,17 @@
|
||||
#include <string>
|
||||
#include "Memory.h"
|
||||
|
||||
std::string test_memory_generateConstPlayfield() {
|
||||
std::map<int, int> 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";
|
||||
}
|
||||
5
language-C++/Memory/src/Memory.h
Normal file
5
language-C++/Memory/src/Memory.h
Normal file
@@ -0,0 +1,5 @@
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
std::map<int, int> memory_generateConstPlayfield(int n);
|
||||
std::string test_memory_generateConstPlayfield();
|
||||
Reference in New Issue
Block a user