This commit is contained in:
Михаил Капелько
2024-03-26 22:33:57 +03:00
parent 2891de43a0
commit 650bf410e8
9 changed files with 7 additions and 7 deletions

16
C++/Memory.Aux.cpp Normal file
View File

@@ -0,0 +1,16 @@
#include <map>
#include "Memory.h"
std::map<int, int> memory_generateConstPlayfield(
int n
) {
std::map<int, int> idGroups;
auto id = 0;
for (int gid = 0; gid < n; ++gid) {
idGroups[id] = gid;
id += 1;
idGroups[id] = gid;
id += 1;
}
return idGroups;
}

17
C++/Memory.Test.cpp Normal file
View 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
C++/Memory.h Normal file
View File

@@ -0,0 +1,5 @@
#include <map>
#include <string>
std::map<int, int> memory_generateConstPlayfield(int n);
std::string test_memory_generateConstPlayfield();

8
C++/main.cpp Normal file
View File

@@ -0,0 +1,8 @@
#include "Memory.h"
#include <iostream>
int main() {
std::cout
<< test_memory_generateConstPlayfield()
<< std::endl;
}