コード例 #1
0
def test_write_timestamp_w_operator():
    system = utils.TestSystem(DOMAIN_ID, "StringTopicType")
    test_timestamp = dds.Time(123)
    system.writer << ("hi", test_timestamp)
    utils.wait(system.reader)
    samples = system.reader.take()
    assert samples[0].info.source_timestamp == test_timestamp
コード例 #2
0
def test_write_w_operator_mix():
    system = utils.TestSystem(DOMAIN_ID, "KeyedStringTopicType")
    sample = dds.KeyedStringTopicType()
    handle = system.writer.register_instance(sample)
    system.writer << (sample, handle) << dds.KeyedStringTopicType(
        "Hi", "Hi") << (
            dds.KeyedStringTopicType("hello", "hello"),
            dds.Time(123),
        )
コード例 #3
0
def test_write_handle_and_timestamp():
    system = utils.TestSystem(DOMAIN_ID, "KeyedStringTopicType")
    sample = dds.KeyedStringTopicType()
    test_timestamp = dds.Time(123)
    handle = system.writer.register_instance(sample)
    system.writer.write(sample, handle, test_timestamp)
    utils.wait(system.reader)
    samples = system.reader.take()
    assert samples[0].info.instance_handle == handle
    assert samples[0].info.source_timestamp == test_timestamp
コード例 #4
0
def test_current_time():
    p = utils.create_participant()
    t = p.current_time
    assert t != dds.Time.invalid()
    assert t > dds.Time(1, 0)