example_test.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. from __future__ import print_function
  2. import os
  3. import sys
  4. try:
  5. import IDF
  6. except ImportError:
  7. # this is a test case write with tiny-test-fw.
  8. # to run test cases outside tiny-test-fw,
  9. # we need to set environment variable `TEST_FW_PATH`,
  10. # then get and insert `TEST_FW_PATH` to sys path before import FW module
  11. test_fw_path = os.getenv('TEST_FW_PATH')
  12. if test_fw_path and test_fw_path not in sys.path:
  13. sys.path.insert(0, test_fw_path)
  14. import IDF
  15. @IDF.idf_example_test(env_tag='Example_WIFI')
  16. def test_real_time_stats_example(env, extra_data):
  17. dut = env.get_dut('cpp_rtti', 'examples/system/cpp_rtti')
  18. dut.start_app()
  19. dut.expect('Type name of std::cout is: std::ostream')
  20. dut.expect('Type name of std::cin is: std::istream')
  21. dut.expect('Type of app_main is: void ()')
  22. dut.expect('Type name of a lambda function is: app_main::{lambda(int, int)#1}')
  23. dut.expect('dynamic_cast<DerivedA*>(obj)=0')
  24. dut.expect('dynamic_cast<DerivedB*>(obj)=0x')
  25. dut.expect('dynamic_cast<DerivedB*>(obj)=0')
  26. dut.expect('dynamic_cast<DerivedA*>(obj)=0x')
  27. dut.expect('Example finished.')
  28. if __name__ == '__main__':
  29. test_real_time_stats_example()