From 050eecea53594694f8e43cbd4e91999b7daa7572 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B8=D1=85=D0=B0=D0=B8=D0=BB=20=D0=9A=D0=B0=D0=BF?= =?UTF-8?q?=D0=B5=D0=BB=D1=8C=D0=BA=D0=BE?= Date: Tue, 26 Mar 2024 23:13:04 +0300 Subject: [PATCH] d --- main.cpp | 7 ++++++- main.js | 8 ++++++-- main.swift | 8 ++++++-- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/main.cpp b/main.cpp index add1041..52ecdef 100644 --- a/main.cpp +++ b/main.cpp @@ -1,6 +1,8 @@ #include #include +// L4: Function. + std::map memory_generateConstPlayfield( int n ) { @@ -15,6 +17,8 @@ std::map memory_generateConstPlayfield( return idGroups; } +// L20: Test. + std::string test_memory_generateConstPlayfield() { auto idGroups = memory_generateConstPlayfield(2); if ( @@ -26,10 +30,11 @@ std::string test_memory_generateConstPlayfield() { ) { return "OK: memory_generateConstPlayfield"; } - return "ERR: memory_generateConstPlayfield"; } +// L36: Run. + int main() { printf("%s\n", test_memory_generateConstPlayfield().c_str()); } diff --git a/main.js b/main.js index ca8a4b4..a21ebeb 100644 --- a/main.js +++ b/main.js @@ -1,6 +1,8 @@ +// L4: Function. + function memory_generateConstPlayfield( n ) { @@ -12,10 +14,11 @@ function memory_generateConstPlayfield( idGroups[id] = gid; id += 1; } - return idGroups; } +// L20: Test. + function test_memory_generateConstPlayfield() { let idGroups = memory_generateConstPlayfield(2) if ( @@ -27,8 +30,9 @@ function test_memory_generateConstPlayfield() { ) { return "OK: memory_generateConstPlayfield" } - return "ERR: memory_generateConstPlayfield" } +// L36: Run. + console.log(test_memory_generateConstPlayfield()) diff --git a/main.swift b/main.swift index 448287a..3a584d8 100644 --- a/main.swift +++ b/main.swift @@ -1,6 +1,8 @@ +// L4: Function + func memory_generateConstPlayfield( _ n: Int ) -> [Int: Int] { @@ -12,10 +14,11 @@ func memory_generateConstPlayfield( idGroups[id] = gid id += 1 } - return idGroups } +// L20: Test. + func test_memory_generateConstPlayfield() -> String { let idGroups = memory_generateConstPlayfield(2) if ( @@ -27,8 +30,9 @@ func test_memory_generateConstPlayfield() -> String { ) { return "OK: memory_generateConstPlayfield" } - return "ERR: memory_generateConstPlayfield" } +// L36: Run. + print(test_memory_generateConstPlayfield())