Skip to content

Commit

Permalink
Test with MS Java
Browse files Browse the repository at this point in the history
  • Loading branch information
EltonCN committed Dec 9, 2024
1 parent 30a8a93 commit f91088d
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions tests/MemoryStorage_ExternalTest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import time

import cst_python as cst
from cst_python.memory_storage import MemoryStorageCodelet

import logging
import sys

if __name__ == "__main__":
ch = logging.StreamHandler(sys.stdout)
ch.setLevel(logging.INFO)

logging.getLogger("MemoryStorageCodelet").addHandler(ch)

SLEEP_TIME = 0.75

mind = cst.Mind()
memory1 = mind.create_memory_object("Memory1", "")

last_timestamp = memory1.get_timestamp()

ms = MemoryStorageCodelet(mind)
ms.time_step = 100
mind.insert_codelet(ms)

mind.start()


valid = False
for i in range(30):
time.sleep(0.1)

if last_timestamp != memory1.get_timestamp() and not memory1.get_info():
valid = True
memory1.set_info(True)
break

time.sleep(SLEEP_TIME)

assert memory1.get_info() == "JAVA_INFO"

memory1.set_info("OTHER_INFO")
time.sleep(SLEEP_TIME)

assert memory1.get_info() == 1

memory1.set_info(-1)
time.sleep(SLEEP_TIME)

assert memory1.get_info() == 1.0

memory1.set_info(5.0)
#time.sleep(SLEEP_TIME)

0 comments on commit f91088d

Please sign in to comment.