From bd5bf9ebe0e389cc60f692699b752cd8dd92a775 Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Thu, 4 Jan 2024 15:47:05 +0900 Subject: [PATCH] Update testoader.js --- data/test-misc.json | 12 +++++++++++- testloader.js | 29 ++++++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/data/test-misc.json b/data/test-misc.json index 83d6e44..2c8d4b2 100644 --- a/data/test-misc.json +++ b/data/test-misc.json @@ -55,8 +55,18 @@ "tags": ["Windows System", "IPC(Inter-Process Communication)"] }, { + "id": "sharedmemory_write", + "description": "Write a text to the (named) shared memory", + "tags": ["Windows System", "IPC(Inter-Process Communication)"] + }, + { + "id": "sharedmemory_read", + "description": "Read a text from the (named) shared memory", + "tags": ["Windows System", "IPC(Inter-Process Communication)"] + } + { "id": "sharedmemory_listener", - "description": "Read a text form the (named) shared memory, Repeatly", + "description": "Read a text from the (named) shared memory, Repeatly", "tags": ["Windows System", "IPC(Inter-Process Communication)"] } ] diff --git a/testloader.js b/testloader.js index 864d6ee..2a270a4 100644 --- a/testloader.js +++ b/testloader.js @@ -847,7 +847,7 @@ var test_implements = { console.log("Writing a text the to shared memory..."); mem.writeText("nice meet you"); - console.log("Writing a text from the shared memory..."); + console.log("Reading a text from the shared memory..."); console.log(mem.readText() + ", too"); console.log("Cleaning the shared memory..."); @@ -859,6 +859,33 @@ var test_implements = { console.log("Done"); }, + + "sharedmemory_write": function() { + var Toolkit = require("lib/toolkit"); + var mem = new Toolkit.NamedSharedMemory("welsonjs_test"); + + console.log("Writing a text to the shared memory..."); + mem.writeText("nice meet you"); + + console.log("Done"); + }, + + "sharedmemory_read": function() { + var Toolkit = require("lib/toolkit"); + var mem = new Toolkit.NamedSharedMemory("welsonjs_test"); + + console.log("Reading a text from the shared memory..."); + console.log(mem.readText() + ", too"); + + console.log("Cleaning the shared memory..."); + mem.clear() + console.log(mem.readText()); + + mem.close() + console.log("Closing the shared memory..."); + + console.log("Done"); + }, "sharedmemory_listener": function() { var Toolkit = require("lib/toolkit");