1# This example code is in the Public Domain (or CC0 licensed, at your option.) 2 3# Unless required by applicable law or agreed to in writing, this 4# software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 5# CONDITIONS OF ANY KIND, either express or implied. 6 7# -*- coding: utf-8 -*- 8 9from __future__ import print_function, unicode_literals 10 11import re 12 13import ttfw_idf 14 15 16@ttfw_idf.idf_example_test(env_tag='Example_GENERIC') 17def test_examples_asio_chat(env, _): # type: (ttfw_idf.TinyFW.Env, None) -> None 18 msg = 'asio-chat: received hi' 19 dut = env.get_dut('asio_chat', 'examples/protocols/asio/asio_chat') 20 # start the test and expect the client to receive back it's original data 21 dut.start_app() 22 dut.expect(re.compile(r'{}'.format('Waiting for input')), timeout=30) 23 dut.write(msg) 24 dut.write('exit') 25 dut.expect(re.compile(r'{}'.format(msg)), timeout=30) 26 27 28if __name__ == '__main__': 29 test_examples_asio_chat() 30