├── .devcontainer └── devcontainer.json ├── .qmake.conf ├── .tag ├── .travis.yml ├── CMakeLists.txt ├── LICENSE ├── README.md ├── edl-v10 ├── epl-v10 ├── examples ├── examples.pro ├── examples.qbs └── qmqtt │ ├── client │ ├── client.pro │ ├── client.qbs │ └── example.cpp │ ├── qmqtt.pro │ └── qmqtt.qbs ├── qmqtt-API.md ├── qmqtt.pri ├── qmqtt.pro ├── qmqtt.qbs ├── src ├── mqtt │ ├── qmqtt.h │ ├── qmqtt.pri │ ├── qmqtt.pro │ ├── qmqtt.qbs │ ├── qmqtt_client.cpp │ ├── qmqtt_client.h │ ├── qmqtt_client_p.cpp │ ├── qmqtt_client_p.h │ ├── qmqtt_frame.cpp │ ├── qmqtt_frame.h │ ├── qmqtt_global.h │ ├── qmqtt_message.cpp │ ├── qmqtt_message.h │ ├── qmqtt_message_p.h │ ├── qmqtt_network.cpp │ ├── qmqtt_network_p.h │ ├── qmqtt_networkinterface.h │ ├── qmqtt_routedmessage.h │ ├── qmqtt_router.cpp │ ├── qmqtt_router.h │ ├── qmqtt_routesubscription.cpp │ ├── qmqtt_routesubscription.h │ ├── qmqtt_socket.cpp │ ├── qmqtt_socket_p.h │ ├── qmqtt_socketinterface.h │ ├── qmqtt_ssl_socket.cpp │ ├── qmqtt_ssl_socket_p.h │ ├── qmqtt_timer.cpp │ ├── qmqtt_timer_p.h │ ├── qmqtt_timerinterface.h │ ├── qmqtt_websocket.cpp │ ├── qmqtt_websocket_p.h │ ├── qmqtt_websocketiodevice.cpp │ └── qmqtt_websocketiodevice_p.h ├── src.pro └── src.qbs ├── sync.profile └── tests ├── auto ├── auto.pro ├── auto.qbs └── cmake │ ├── CMakeLists.txt │ ├── cmake.pro │ └── cmake.qbs ├── benchmarks ├── benchmarks.pro └── message │ ├── main.cpp │ └── message.pro ├── gtest ├── gtest.pro ├── gtest.qbs ├── gtest │ ├── googletest │ │ ├── .travis.yml │ │ ├── CMakeLists.txt │ │ ├── README.md │ │ ├── googlemock │ │ │ ├── CHANGES │ │ │ ├── CMakeLists.txt │ │ │ ├── CONTRIBUTORS │ │ │ ├── LICENSE │ │ │ ├── Makefile.am │ │ │ ├── README.md │ │ │ ├── build-aux │ │ │ │ └── .keep │ │ │ ├── configure.ac │ │ │ ├── docs │ │ │ │ ├── CheatSheet.md │ │ │ │ ├── CookBook.md │ │ │ │ ├── DesignDoc.md │ │ │ │ ├── DevGuide.md │ │ │ │ ├── Documentation.md │ │ │ │ ├── ForDummies.md │ │ │ │ ├── FrequentlyAskedQuestions.md │ │ │ │ ├── KnownIssues.md │ │ │ │ ├── v1_5 │ │ │ │ │ ├── CheatSheet.md │ │ │ │ │ ├── CookBook.md │ │ │ │ │ ├── Documentation.md │ │ │ │ │ ├── ForDummies.md │ │ │ │ │ └── FrequentlyAskedQuestions.md │ │ │ │ ├── v1_6 │ │ │ │ │ ├── CheatSheet.md │ │ │ │ │ ├── CookBook.md │ │ │ │ │ ├── Documentation.md │ │ │ │ │ ├── ForDummies.md │ │ │ │ │ └── FrequentlyAskedQuestions.md │ │ │ │ └── v1_7 │ │ │ │ │ ├── CheatSheet.md │ │ │ │ │ ├── CookBook.md │ │ │ │ │ ├── Documentation.md │ │ │ │ │ ├── ForDummies.md │ │ │ │ │ └── FrequentlyAskedQuestions.md │ │ │ ├── include │ │ │ │ └── gmock │ │ │ │ │ ├── gmock-actions.h │ │ │ │ │ ├── gmock-cardinalities.h │ │ │ │ │ ├── gmock-generated-actions.h │ │ │ │ │ ├── gmock-generated-actions.h.pump │ │ │ │ │ ├── gmock-generated-function-mockers.h │ │ │ │ │ ├── gmock-generated-function-mockers.h.pump │ │ │ │ │ ├── gmock-generated-matchers.h │ │ │ │ │ ├── gmock-generated-matchers.h.pump │ │ │ │ │ ├── gmock-generated-nice-strict.h │ │ │ │ │ ├── gmock-generated-nice-strict.h.pump │ │ │ │ │ ├── gmock-matchers.h │ │ │ │ │ ├── gmock-more-actions.h │ │ │ │ │ ├── gmock-more-matchers.h │ │ │ │ │ ├── gmock-spec-builders.h │ │ │ │ │ ├── gmock.h │ │ │ │ │ └── internal │ │ │ │ │ ├── custom │ │ │ │ │ ├── gmock-generated-actions.h │ │ │ │ │ ├── gmock-generated-actions.h.pump │ │ │ │ │ ├── gmock-matchers.h │ │ │ │ │ └── gmock-port.h │ │ │ │ │ ├── gmock-generated-internal-utils.h │ │ │ │ │ ├── gmock-generated-internal-utils.h.pump │ │ │ │ │ ├── gmock-internal-utils.h │ │ │ │ │ └── gmock-port.h │ │ │ ├── make │ │ │ │ └── Makefile │ │ │ ├── msvc │ │ │ │ ├── 2005 │ │ │ │ │ ├── gmock.sln │ │ │ │ │ ├── gmock.vcproj │ │ │ │ │ ├── gmock_config.vsprops │ │ │ │ │ ├── gmock_main.vcproj │ │ │ │ │ └── gmock_test.vcproj │ │ │ │ └── 2010 │ │ │ │ │ ├── gmock.sln │ │ │ │ │ ├── gmock.vcxproj │ │ │ │ │ ├── gmock_config.props │ │ │ │ │ ├── gmock_main.vcxproj │ │ │ │ │ └── gmock_test.vcxproj │ │ │ ├── scripts │ │ │ │ ├── fuse_gmock_files.py │ │ │ │ ├── generator │ │ │ │ │ ├── LICENSE │ │ │ │ │ ├── README │ │ │ │ │ ├── README.cppclean │ │ │ │ │ ├── cpp │ │ │ │ │ │ ├── __init__.py │ │ │ │ │ │ ├── ast.py │ │ │ │ │ │ ├── gmock_class.py │ │ │ │ │ │ ├── gmock_class_test.py │ │ │ │ │ │ ├── keywords.py │ │ │ │ │ │ ├── tokenize.py │ │ │ │ │ │ └── utils.py │ │ │ │ │ └── gmock_gen.py │ │ │ │ ├── gmock-config.in │ │ │ │ ├── gmock_doctor.py │ │ │ │ ├── upload.py │ │ │ │ └── upload_gmock.py │ │ │ ├── src │ │ │ │ ├── gmock-all.cc │ │ │ │ ├── gmock-cardinalities.cc │ │ │ │ ├── gmock-internal-utils.cc │ │ │ │ ├── gmock-matchers.cc │ │ │ │ ├── gmock-spec-builders.cc │ │ │ │ ├── gmock.cc │ │ │ │ └── gmock_main.cc │ │ │ └── test │ │ │ │ ├── gmock-actions_test.cc │ │ │ │ ├── gmock-cardinalities_test.cc │ │ │ │ ├── gmock-generated-actions_test.cc │ │ │ │ ├── gmock-generated-function-mockers_test.cc │ │ │ │ ├── gmock-generated-internal-utils_test.cc │ │ │ │ ├── gmock-generated-matchers_test.cc │ │ │ │ ├── gmock-internal-utils_test.cc │ │ │ │ ├── gmock-matchers_test.cc │ │ │ │ ├── gmock-more-actions_test.cc │ │ │ │ ├── gmock-nice-strict_test.cc │ │ │ │ ├── gmock-port_test.cc │ │ │ │ ├── gmock-spec-builders_test.cc │ │ │ │ ├── gmock_all_test.cc │ │ │ │ ├── gmock_ex_test.cc │ │ │ │ ├── gmock_leak_test.py │ │ │ │ ├── gmock_leak_test_.cc │ │ │ │ ├── gmock_link2_test.cc │ │ │ │ ├── gmock_link_test.cc │ │ │ │ ├── gmock_link_test.h │ │ │ │ ├── gmock_output_test.py │ │ │ │ ├── gmock_output_test_.cc │ │ │ │ ├── gmock_output_test_golden.txt │ │ │ │ ├── gmock_stress_test.cc │ │ │ │ ├── gmock_test.cc │ │ │ │ └── gmock_test_utils.py │ │ ├── googletest │ │ │ ├── CHANGES │ │ │ ├── CMakeLists.txt │ │ │ ├── CONTRIBUTORS │ │ │ ├── LICENSE │ │ │ ├── Makefile.am │ │ │ ├── README.md │ │ │ ├── build-aux │ │ │ │ └── .keep │ │ │ ├── cmake │ │ │ │ └── internal_utils.cmake │ │ │ ├── codegear │ │ │ │ ├── gtest.cbproj │ │ │ │ ├── gtest.groupproj │ │ │ │ ├── gtest_all.cc │ │ │ │ ├── gtest_link.cc │ │ │ │ ├── gtest_main.cbproj │ │ │ │ └── gtest_unittest.cbproj │ │ │ ├── configure.ac │ │ │ ├── docs │ │ │ │ ├── AdvancedGuide.md │ │ │ │ ├── DevGuide.md │ │ │ │ ├── Documentation.md │ │ │ │ ├── FAQ.md │ │ │ │ ├── Primer.md │ │ │ │ ├── PumpManual.md │ │ │ │ ├── Samples.md │ │ │ │ ├── V1_5_AdvancedGuide.md │ │ │ │ ├── V1_5_Documentation.md │ │ │ │ ├── V1_5_FAQ.md │ │ │ │ ├── V1_5_Primer.md │ │ │ │ ├── V1_5_PumpManual.md │ │ │ │ ├── V1_5_XcodeGuide.md │ │ │ │ ├── V1_6_AdvancedGuide.md │ │ │ │ ├── V1_6_Documentation.md │ │ │ │ ├── V1_6_FAQ.md │ │ │ │ ├── V1_6_Primer.md │ │ │ │ ├── V1_6_PumpManual.md │ │ │ │ ├── V1_6_Samples.md │ │ │ │ ├── V1_6_XcodeGuide.md │ │ │ │ ├── V1_7_AdvancedGuide.md │ │ │ │ ├── V1_7_Documentation.md │ │ │ │ ├── V1_7_FAQ.md │ │ │ │ ├── V1_7_Primer.md │ │ │ │ ├── V1_7_PumpManual.md │ │ │ │ ├── V1_7_Samples.md │ │ │ │ ├── V1_7_XcodeGuide.md │ │ │ │ └── XcodeGuide.md │ │ │ ├── include │ │ │ │ └── gtest │ │ │ │ │ ├── gtest-death-test.h │ │ │ │ │ ├── gtest-message.h │ │ │ │ │ ├── gtest-param-test.h │ │ │ │ │ ├── gtest-param-test.h.pump │ │ │ │ │ ├── gtest-printers.h │ │ │ │ │ ├── gtest-spi.h │ │ │ │ │ ├── gtest-test-part.h │ │ │ │ │ ├── gtest-typed-test.h │ │ │ │ │ ├── gtest.h │ │ │ │ │ ├── gtest_pred_impl.h │ │ │ │ │ ├── gtest_prod.h │ │ │ │ │ └── internal │ │ │ │ │ ├── custom │ │ │ │ │ ├── gtest-port.h │ │ │ │ │ ├── gtest-printers.h │ │ │ │ │ └── gtest.h │ │ │ │ │ ├── gtest-death-test-internal.h │ │ │ │ │ ├── gtest-filepath.h │ │ │ │ │ ├── gtest-internal.h │ │ │ │ │ ├── gtest-linked_ptr.h │ │ │ │ │ ├── gtest-param-util-generated.h │ │ │ │ │ ├── gtest-param-util-generated.h.pump │ │ │ │ │ ├── gtest-param-util.h │ │ │ │ │ ├── gtest-port-arch.h │ │ │ │ │ ├── gtest-port.h │ │ │ │ │ ├── gtest-string.h │ │ │ │ │ ├── gtest-tuple.h │ │ │ │ │ ├── gtest-tuple.h.pump │ │ │ │ │ ├── gtest-type-util.h │ │ │ │ │ └── gtest-type-util.h.pump │ │ │ ├── m4 │ │ │ │ ├── acx_pthread.m4 │ │ │ │ └── gtest.m4 │ │ │ ├── make │ │ │ │ └── Makefile │ │ │ ├── msvc │ │ │ │ ├── gtest-md.sln │ │ │ │ ├── gtest-md.vcproj │ │ │ │ ├── gtest.sln │ │ │ │ ├── gtest.vcproj │ │ │ │ ├── gtest_main-md.vcproj │ │ │ │ ├── gtest_main.vcproj │ │ │ │ ├── gtest_prod_test-md.vcproj │ │ │ │ ├── gtest_prod_test.vcproj │ │ │ │ ├── gtest_unittest-md.vcproj │ │ │ │ └── gtest_unittest.vcproj │ │ │ ├── samples │ │ │ │ ├── prime_tables.h │ │ │ │ ├── sample1.cc │ │ │ │ ├── sample1.h │ │ │ │ ├── sample10_unittest.cc │ │ │ │ ├── sample1_unittest.cc │ │ │ │ ├── sample2.cc │ │ │ │ ├── sample2.h │ │ │ │ ├── sample2_unittest.cc │ │ │ │ ├── sample3-inl.h │ │ │ │ ├── sample3_unittest.cc │ │ │ │ ├── sample4.cc │ │ │ │ ├── sample4.h │ │ │ │ ├── sample4_unittest.cc │ │ │ │ ├── sample5_unittest.cc │ │ │ │ ├── sample6_unittest.cc │ │ │ │ ├── sample7_unittest.cc │ │ │ │ ├── sample8_unittest.cc │ │ │ │ └── sample9_unittest.cc │ │ │ ├── scripts │ │ │ │ ├── common.py │ │ │ │ ├── fuse_gtest_files.py │ │ │ │ ├── gen_gtest_pred_impl.py │ │ │ │ ├── gtest-config.in │ │ │ │ ├── pump.py │ │ │ │ ├── release_docs.py │ │ │ │ ├── test │ │ │ │ │ └── Makefile │ │ │ │ ├── upload.py │ │ │ │ └── upload_gtest.py │ │ │ ├── src │ │ │ │ ├── gtest-all.cc │ │ │ │ ├── gtest-death-test.cc │ │ │ │ ├── gtest-filepath.cc │ │ │ │ ├── gtest-internal-inl.h │ │ │ │ ├── gtest-port.cc │ │ │ │ ├── gtest-printers.cc │ │ │ │ ├── gtest-test-part.cc │ │ │ │ ├── gtest-typed-test.cc │ │ │ │ ├── gtest.cc │ │ │ │ └── gtest_main.cc │ │ │ ├── test │ │ │ │ ├── gtest-death-test_ex_test.cc │ │ │ │ ├── gtest-death-test_test.cc │ │ │ │ ├── gtest-filepath_test.cc │ │ │ │ ├── gtest-linked_ptr_test.cc │ │ │ │ ├── gtest-listener_test.cc │ │ │ │ ├── gtest-message_test.cc │ │ │ │ ├── gtest-options_test.cc │ │ │ │ ├── gtest-param-test2_test.cc │ │ │ │ ├── gtest-param-test_test.cc │ │ │ │ ├── gtest-param-test_test.h │ │ │ │ ├── gtest-port_test.cc │ │ │ │ ├── gtest-printers_test.cc │ │ │ │ ├── gtest-test-part_test.cc │ │ │ │ ├── gtest-tuple_test.cc │ │ │ │ ├── gtest-typed-test2_test.cc │ │ │ │ ├── gtest-typed-test_test.cc │ │ │ │ ├── gtest-typed-test_test.h │ │ │ │ ├── gtest-unittest-api_test.cc │ │ │ │ ├── gtest_all_test.cc │ │ │ │ ├── gtest_break_on_failure_unittest.py │ │ │ │ ├── gtest_break_on_failure_unittest_.cc │ │ │ │ ├── gtest_catch_exceptions_test.py │ │ │ │ ├── gtest_catch_exceptions_test_.cc │ │ │ │ ├── gtest_color_test.py │ │ │ │ ├── gtest_color_test_.cc │ │ │ │ ├── gtest_env_var_test.py │ │ │ │ ├── gtest_env_var_test_.cc │ │ │ │ ├── gtest_environment_test.cc │ │ │ │ ├── gtest_filter_unittest.py │ │ │ │ ├── gtest_filter_unittest_.cc │ │ │ │ ├── gtest_help_test.py │ │ │ │ ├── gtest_help_test_.cc │ │ │ │ ├── gtest_list_tests_unittest.py │ │ │ │ ├── gtest_list_tests_unittest_.cc │ │ │ │ ├── gtest_main_unittest.cc │ │ │ │ ├── gtest_no_test_unittest.cc │ │ │ │ ├── gtest_output_test.py │ │ │ │ ├── gtest_output_test_.cc │ │ │ │ ├── gtest_output_test_golden_lin.txt │ │ │ │ ├── gtest_pred_impl_unittest.cc │ │ │ │ ├── gtest_premature_exit_test.cc │ │ │ │ ├── gtest_prod_test.cc │ │ │ │ ├── gtest_repeat_test.cc │ │ │ │ ├── gtest_shuffle_test.py │ │ │ │ ├── gtest_shuffle_test_.cc │ │ │ │ ├── gtest_sole_header_test.cc │ │ │ │ ├── gtest_stress_test.cc │ │ │ │ ├── gtest_test_utils.py │ │ │ │ ├── gtest_throw_on_failure_ex_test.cc │ │ │ │ ├── gtest_throw_on_failure_test.py │ │ │ │ ├── gtest_throw_on_failure_test_.cc │ │ │ │ ├── gtest_uninitialized_test.py │ │ │ │ ├── gtest_uninitialized_test_.cc │ │ │ │ ├── gtest_unittest.cc │ │ │ │ ├── gtest_xml_outfile1_test_.cc │ │ │ │ ├── gtest_xml_outfile2_test_.cc │ │ │ │ ├── gtest_xml_outfiles_test.py │ │ │ │ ├── gtest_xml_output_unittest.py │ │ │ │ ├── gtest_xml_output_unittest_.cc │ │ │ │ ├── gtest_xml_test_utils.py │ │ │ │ ├── production.cc │ │ │ │ └── production.h │ │ │ └── xcode │ │ │ │ ├── Config │ │ │ │ ├── DebugProject.xcconfig │ │ │ │ ├── FrameworkTarget.xcconfig │ │ │ │ ├── General.xcconfig │ │ │ │ ├── ReleaseProject.xcconfig │ │ │ │ ├── StaticLibraryTarget.xcconfig │ │ │ │ └── TestTarget.xcconfig │ │ │ │ ├── Resources │ │ │ │ └── Info.plist │ │ │ │ ├── Samples │ │ │ │ └── FrameworkSample │ │ │ │ │ ├── Info.plist │ │ │ │ │ ├── WidgetFramework.xcodeproj │ │ │ │ │ └── project.pbxproj │ │ │ │ │ ├── runtests.sh │ │ │ │ │ ├── widget.cc │ │ │ │ │ ├── widget.h │ │ │ │ │ └── widget_test.cc │ │ │ │ ├── Scripts │ │ │ │ ├── runtests.sh │ │ │ │ └── versiongenerate.py │ │ │ │ └── gtest.xcodeproj │ │ │ │ └── project.pbxproj │ │ └── travis.sh │ ├── gtest.pro │ └── gtest.qbs └── tests │ ├── clienttest.cpp │ ├── customprinter.cpp │ ├── customprinter.h │ ├── frametest.cpp │ ├── iodevicemock.h │ ├── main.cpp │ ├── messagetest.cpp │ ├── networkmock.h │ ├── networktest.cpp │ ├── routedmessagetests.cpp │ ├── routertests.cpp │ ├── routesubscriptiontests.cpp │ ├── socketmock.h │ ├── sockettest.cpp │ ├── tcpserver.cpp │ ├── tcpserver.h │ ├── tests.pro │ ├── tests.qbs │ └── timermock.h ├── tests.pro └── tests.qbs /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "image": "mcr.microsoft.com/devcontainers/universal:2", 3 | "features": { 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /.qmake.conf: -------------------------------------------------------------------------------- 1 | load(qt_build_config) 2 | CONFIG += warning_clean 3 | 4 | MODULE_VERSION = 1.0.3 5 | -------------------------------------------------------------------------------- /.tag: -------------------------------------------------------------------------------- 1 | 39c3e8af25407e25590b511c1e9387deabe89bac 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | dist: xenial 2 | 3 | language: cpp 4 | compiler: 5 | - gcc 6 | 7 | addons: 8 | apt: 9 | sources: 10 | - sourceline: 'ppa:beineri/opt-qt571-xenial' 11 | packages: 12 | - qt57base 13 | - qt57tools 14 | - qt57websockets 15 | - cmake 16 | 17 | before_install: 18 | - source /opt/qt57/bin/qt57-env.sh 19 | 20 | script: 21 | - qmake --version 22 | - $CXX --version 23 | - qmake 24 | - make CXX=$CXX 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This project is dual licensed under the Eclipse Public License 1.0 and the 2 | Eclipse Distribution License 1.0 as described in the epl-v10 and edl-v10 files. 3 | -------------------------------------------------------------------------------- /edl-v10: -------------------------------------------------------------------------------- 1 | Eclipse Distribution License - v 1.0 2 | 3 | Copyright (c) 2007, Eclipse Foundation, Inc. and its licensors. 4 | 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 10 | Redistributions of source code must retain the above copyright notice, this 11 | list of conditions and the following disclaimer. 12 | 13 | Redistributions in binary form must reproduce the above copyright notice, 14 | this list of conditions and the following disclaimer in the documentation 15 | and/or other materials provided with the distribution. 16 | 17 | Neither the name of the Eclipse Foundation, Inc. nor the names of its 18 | contributors may be used to endorse or promote products derived from this 19 | software without specific prior written permission. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 22 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 23 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 25 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 27 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 28 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /examples/examples.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | SUBDIRS += \ 3 | qmqtt 4 | -------------------------------------------------------------------------------- /examples/examples.qbs: -------------------------------------------------------------------------------- 1 | import qbs 2 | 3 | Project { 4 | name: "Examples" 5 | 6 | references: [ 7 | "qmqtt" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /examples/qmqtt/client/client.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = app 2 | TARGET = qmqtt_example 3 | QT = core network qmqtt 4 | 5 | SOURCES += \ 6 | example.cpp 7 | 8 | target.path = $$[QT_INSTALL_EXAMPLES]/qmqtt/client 9 | INSTALLS += target 10 | -------------------------------------------------------------------------------- /examples/qmqtt/client/client.qbs: -------------------------------------------------------------------------------- 1 | import qbs 2 | 3 | QtApplication { 4 | name: "Client" 5 | targetName: "qmqtt_example" 6 | 7 | files: [ 8 | "example.cpp" 9 | ] 10 | 11 | Depends { 12 | name: "Qt" 13 | submodules: [ 14 | "core", 15 | "network", 16 | ] 17 | } 18 | 19 | Depends { 20 | name: "qmqtt" 21 | } 22 | 23 | Group { 24 | fileTagsFilter: "application" 25 | qbs.install: true 26 | qbs.installDir: "bin" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /examples/qmqtt/qmqtt.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | SUBDIRS += \ 3 | client 4 | -------------------------------------------------------------------------------- /examples/qmqtt/qmqtt.qbs: -------------------------------------------------------------------------------- 1 | import qbs 2 | 3 | Project { 4 | name: "qmqtt" 5 | 6 | references: [ 7 | "client" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /qmqtt.pri: -------------------------------------------------------------------------------- 1 | # 2 | # Add the source folder to the include directories to be searched while 3 | # compiling a project, this allows developers to write "#include " in 4 | # their respective projects. 5 | # 6 | INCLUDEPATH += $$PWD/src/mqtt 7 | 8 | # 9 | # Do not add DLL import/export symbols as we are compiling QMQTT source code 10 | # directly with the source code of the project that includes this file. 11 | # 12 | DEFINES += MQTT_PROJECT_INCLUDE_SRC 13 | 14 | # 15 | # Add header files 16 | # 17 | HEADERS += \ 18 | $$PWD/src/mqtt/qmqtt.h \ 19 | $$PWD/src/mqtt/qmqtt_client.h \ 20 | $$PWD/src/mqtt/qmqtt_client_p.h \ 21 | $$PWD/src/mqtt/qmqtt_frame.h \ 22 | $$PWD/src/mqtt/qmqtt_global.h \ 23 | $$PWD/src/mqtt/qmqtt_message.h \ 24 | $$PWD/src/mqtt/qmqtt_message_p.h \ 25 | $$PWD/src/mqtt/qmqtt_network_p.h \ 26 | $$PWD/src/mqtt/qmqtt_networkinterface.h \ 27 | $$PWD/src/mqtt/qmqtt_routedmessage.h \ 28 | $$PWD/src/mqtt/qmqtt_router.h \ 29 | $$PWD/src/mqtt/qmqtt_routesubscription.h \ 30 | $$PWD/src/mqtt/qmqtt_socket_p.h \ 31 | $$PWD/src/mqtt/qmqtt_socketinterface.h \ 32 | $$PWD/src/mqtt/qmqtt_timer_p.h \ 33 | $$PWD/src/mqtt/qmqtt_timerinterface.h \ 34 | $$PWD/src/mqtt/qmqtt_ssl_socket_p.h 35 | 36 | # 37 | # Add source files 38 | # 39 | SOURCES += \ 40 | $$PWD/src/mqtt/qmqtt_client.cpp \ 41 | $$PWD/src/mqtt/qmqtt_client_p.cpp \ 42 | $$PWD/src/mqtt/qmqtt_frame.cpp \ 43 | $$PWD/src/mqtt/qmqtt_message.cpp \ 44 | $$PWD/src/mqtt/qmqtt_network.cpp \ 45 | $$PWD/src/mqtt/qmqtt_router.cpp \ 46 | $$PWD/src/mqtt/qmqtt_routesubscription.cpp \ 47 | $$PWD/src/mqtt/qmqtt_socket.cpp \ 48 | $$PWD/src/mqtt/qmqtt_timer.cpp \ 49 | $$PWD/src/mqtt/qmqtt_ssl_socket.cpp 50 | 51 | # 52 | # Add support for websockets 53 | # 54 | QMQTT_WEBSOCKETS { 55 | HEADERS += \ 56 | $$PWD/src/mqtt/qmqtt_websocket_p.h \ 57 | $$PWD/src/mqtt/qmqtt_websocketiodevice_p.h 58 | 59 | SOURCES += \ 60 | $$PWD/src/mqtt/qmqtt_websocket.cpp \ 61 | $$PWD/src/mqtt/qmqtt_websocketiodevice.cpp 62 | } 63 | -------------------------------------------------------------------------------- /qmqtt.pro: -------------------------------------------------------------------------------- 1 | load(qt_parts) 2 | -------------------------------------------------------------------------------- /qmqtt.qbs: -------------------------------------------------------------------------------- 1 | import qbs 2 | 3 | Project { 4 | name: "QMQTT" 5 | 6 | references: [ 7 | "examples", 8 | "src", 9 | "tests", 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /src/mqtt/qmqtt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * qmqtt.h - qmqtt library heaer 3 | * 4 | * Copyright (c) 2013 Ery Lee 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 10 | * * Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * * Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * * Neither the name of mqttc nor the names of its contributors may be used 16 | * to endorse or promote products derived from this software without 17 | * specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | #ifndef QMQTT_H 33 | #define QMQTT_H 34 | 35 | #include 36 | #include 37 | 38 | #endif // QMQTT_H 39 | -------------------------------------------------------------------------------- /src/mqtt/qmqtt.pri: -------------------------------------------------------------------------------- 1 | INCLUDEPATH += $$PWD 2 | 3 | PUBLIC_HEADERS += \ 4 | $$PWD/qmqtt_client.h \ 5 | $$PWD/qmqtt_frame.h \ 6 | $$PWD/qmqtt_message.h \ 7 | $$PWD/qmqtt_routesubscription.h \ 8 | $$PWD/qmqtt_routedmessage.h \ 9 | $$PWD/qmqtt_router.h \ 10 | $$PWD/qmqtt_networkinterface.h \ 11 | $$PWD/qmqtt_socketinterface.h \ 12 | $$PWD/qmqtt_timerinterface.h 13 | 14 | PRIVATE_HEADERS += \ 15 | $$PWD/qmqtt_client_p.h \ 16 | $$PWD/qmqtt_message_p.h \ 17 | $$PWD/qmqtt_network_p.h \ 18 | $$PWD/qmqtt_socket_p.h \ 19 | $$PWD/qmqtt_timer_p.h 20 | 21 | SOURCES += \ 22 | $$PWD/qmqtt_client_p.cpp \ 23 | $$PWD/qmqtt_client.cpp \ 24 | $$PWD/qmqtt_frame.cpp \ 25 | $$PWD/qmqtt_message.cpp \ 26 | $$PWD/qmqtt_network.cpp \ 27 | $$PWD/qmqtt_routesubscription.cpp \ 28 | $$PWD/qmqtt_router.cpp \ 29 | $$PWD/qmqtt_socket.cpp \ 30 | $$PWD/qmqtt_timer.cpp 31 | 32 | QMQTT_WEBSOCKETS { 33 | PRIVATE_HEADERS += \ 34 | $$PWD/qmqtt_websocket_p.h \ 35 | $$PWD/qmqtt_websocketiodevice_p.h 36 | 37 | SOURCES += \ 38 | $$PWD/qmqtt_websocket.cpp \ 39 | $$PWD/qmqtt_websocketiodevice.cpp 40 | } 41 | 42 | !contains(CONFIG, QMQTT_NO_SSL) { 43 | PRIVATE_HEADERS += \ 44 | $$PWD/qmqtt_ssl_socket_p.h 45 | 46 | SOURCES += \ 47 | $$PWD/qmqtt_ssl_socket.cpp 48 | } 49 | -------------------------------------------------------------------------------- /src/mqtt/qmqtt.pro: -------------------------------------------------------------------------------- 1 | TARGET = QtQmqtt 2 | QT = core network 3 | qtHaveModule(websockets): QMQTT_WEBSOCKETS: QT += websockets 4 | 5 | DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII 6 | 7 | # CONFIG += QMQTT_NO_SSL 8 | 9 | HEADERS += \ 10 | $$PWD/qmqtt_global.h \ 11 | $$PWD/qmqtt.h 12 | 13 | include(qmqtt.pri) 14 | 15 | HEADERS += $$PUBLIC_HEADERS $$PRIVATE_HEADERS 16 | 17 | load(qt_module) 18 | -------------------------------------------------------------------------------- /src/mqtt/qmqtt_global.h: -------------------------------------------------------------------------------- 1 | /* 2 | * qmqtt_global.h - qmqtt libray global 3 | * 4 | * Copyright (c) 2013 Ery Lee 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 10 | * * Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * * Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * * Neither the name of mqttc nor the names of its contributors may be used 16 | * to endorse or promote products derived from this software without 17 | * specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | #ifndef QMQTT_GLOBAL_H 33 | #define QMQTT_GLOBAL_H 34 | 35 | #include 36 | 37 | #if !defined(QT_STATIC) && !defined(MQTT_PROJECT_INCLUDE_SRC) 38 | # if defined(QT_BUILD_QMQTT_LIB) 39 | # define Q_MQTT_EXPORT Q_DECL_EXPORT 40 | # else 41 | # define Q_MQTT_EXPORT Q_DECL_IMPORT 42 | # endif 43 | #else 44 | # define Q_MQTT_EXPORT 45 | #endif 46 | 47 | #endif // QMQTT_GLOBAL_H 48 | 49 | -------------------------------------------------------------------------------- /src/mqtt/qmqtt_message_p.h: -------------------------------------------------------------------------------- 1 | /* 2 | * qmqtt_message.h - qmqtt message private header 3 | * 4 | * Copyright (c) 2013 Ery Lee 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 10 | * * Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * * Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * * Neither the name of mqttc nor the names of its contributors may be used 16 | * to endorse or promote products derived from this software without 17 | * specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | #ifndef QMQTT_MESSAGE_P_H 33 | #define QMQTT_MESSAGE_P_H 34 | 35 | #include 36 | #include 37 | #include 38 | 39 | namespace QMQTT { 40 | 41 | class MessagePrivate : public QSharedData 42 | { 43 | public: 44 | inline MessagePrivate() 45 | : QSharedData(), 46 | id(0), 47 | qos(0), 48 | retain(false), 49 | dup(false) 50 | {} 51 | 52 | inline MessagePrivate(const MessagePrivate &other) 53 | : QSharedData(other), 54 | id(other.id), 55 | qos(other.qos), 56 | retain(other.retain), 57 | dup(other.dup), 58 | topic(other.topic), 59 | payload(other.payload) 60 | {} 61 | 62 | inline MessagePrivate(quint16 id, const QString &topic, const QByteArray &payload, 63 | quint8 qos, bool retain, bool dup) 64 | : QSharedData(), 65 | id(id), 66 | qos(qos), 67 | retain(retain), 68 | dup(dup), 69 | topic(topic), 70 | payload(payload) 71 | {} 72 | 73 | quint16 id; 74 | quint8 qos : 2; 75 | quint8 retain: 1; 76 | quint8 dup: 1; 77 | QString topic; 78 | QByteArray payload; 79 | }; 80 | 81 | } // namespace QMQTT 82 | 83 | #endif // QMQTT_MESSAGE_P_H 84 | -------------------------------------------------------------------------------- /src/mqtt/qmqtt_routedmessage.h: -------------------------------------------------------------------------------- 1 | /* 2 | * qmqtt_router.h - qmqtt router 3 | * 4 | * Copyright (c) 2013 Ery Lee 5 | * Router added by Niklas Wulf 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright notice, 12 | * this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * * Neither the name of mqttc nor the names of its contributors may be used 17 | * to endorse or promote products derived from this software without 18 | * specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 24 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 | * POSSIBILITY OF SUCH DAMAGE. 31 | * 32 | */ 33 | #ifndef QMQTT_ROUTEDMESSAGE_H 34 | #define QMQTT_ROUTEDMESSAGE_H 35 | 36 | #include 37 | 38 | #include 39 | #include 40 | #include 41 | 42 | namespace QMQTT { 43 | 44 | class RouteSubscription; 45 | 46 | class Q_MQTT_EXPORT RoutedMessage 47 | { 48 | public: 49 | inline RoutedMessage() 50 | {} 51 | inline RoutedMessage(const Message &message) 52 | : _message(message) 53 | {} 54 | 55 | inline const Message &message() const 56 | { return _message; } 57 | inline QHash parameters() const 58 | { return _parameters; } 59 | 60 | private: 61 | friend class RouteSubscription; 62 | 63 | Message _message; 64 | QHash _parameters; 65 | }; 66 | 67 | } // namespace QMQTT 68 | 69 | Q_DECLARE_METATYPE(QMQTT::RoutedMessage) 70 | 71 | #endif // QMQTT_ROUTEDMESSAGE_H 72 | -------------------------------------------------------------------------------- /src/mqtt/qmqtt_router.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * qmqtt_router.cpp - qmqtt router 3 | * 4 | * Copyright (c) 2013 Ery Lee 5 | * Router added by Niklas Wulf 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright notice, 12 | * this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * * Neither the name of mqttc nor the names of its contributors may be used 17 | * to endorse or promote products derived from this software without 18 | * specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 24 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 | * POSSIBILITY OF SUCH DAMAGE. 31 | * 32 | */ 33 | 34 | #include "qmqtt_router.h" 35 | #include "qmqtt_client.h" 36 | #include "qmqtt_routesubscription.h" 37 | 38 | #include 39 | 40 | namespace QMQTT { 41 | 42 | Q_LOGGING_CATEGORY(router, "qmqtt.router") 43 | 44 | Router::Router(Client *parent) : QObject(parent), _client(parent) 45 | { 46 | } 47 | 48 | RouteSubscription *Router::subscribe(const QString &route) 49 | { 50 | RouteSubscription *subscription = new RouteSubscription(this); 51 | subscription->setRoute(route); 52 | connect(_client, &Client::connected, subscription, [this, subscription]() { 53 | _client->subscribe(subscription->_topic, 0); 54 | }); 55 | if (_client->isConnectedToHost()) 56 | _client->subscribe(subscription->_topic, 0); 57 | connect(_client, &Client::received, subscription, &RouteSubscription::routeMessage); 58 | return subscription; 59 | } 60 | 61 | Client *Router::client() const 62 | { 63 | return _client; 64 | } 65 | 66 | } // namespace QMQTT 67 | 68 | -------------------------------------------------------------------------------- /src/mqtt/qmqtt_router.h: -------------------------------------------------------------------------------- 1 | /* 2 | * qmqtt_router.h - qmqtt router 3 | * 4 | * Copyright (c) 2013 Ery Lee 5 | * Router added by Niklas Wulf 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright notice, 12 | * this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * * Neither the name of mqttc nor the names of its contributors may be used 17 | * to endorse or promote products derived from this software without 18 | * specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 24 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 | * POSSIBILITY OF SUCH DAMAGE. 31 | * 32 | */ 33 | #ifndef QMQTT_ROUTER_H 34 | #define QMQTT_ROUTER_H 35 | 36 | #include 37 | 38 | #include 39 | 40 | namespace QMQTT { 41 | 42 | class Client; 43 | class RouteSubscription; 44 | 45 | class Q_MQTT_EXPORT Router : public QObject 46 | { 47 | Q_OBJECT 48 | public: 49 | explicit Router(Client *parent = nullptr); 50 | 51 | RouteSubscription *subscribe(const QString &route); 52 | Client *client() const; 53 | 54 | private: 55 | Client *_client; 56 | }; 57 | 58 | } // namespace QMQTT 59 | 60 | #endif // QMQTT_ROUTER_H 61 | -------------------------------------------------------------------------------- /src/mqtt/qmqtt_routesubscription.h: -------------------------------------------------------------------------------- 1 | /* 2 | * qmqtt_router.h - qmqtt router 3 | * 4 | * Copyright (c) 2013 Ery Lee 5 | * Router added by Niklas Wulf 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright notice, 12 | * this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * * Neither the name of mqttc nor the names of its contributors may be used 17 | * to endorse or promote products derived from this software without 18 | * specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 24 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 | * POSSIBILITY OF SUCH DAMAGE. 31 | * 32 | */ 33 | #ifndef QMQTT_ROUTESUBSCRIPTION_H 34 | #define QMQTT_ROUTESUBSCRIPTION_H 35 | 36 | #include 37 | 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | 44 | namespace QMQTT { 45 | 46 | class Client; 47 | class Message; 48 | class RoutedMessage; 49 | class Router; 50 | 51 | class Q_MQTT_EXPORT RouteSubscription : public QObject 52 | { 53 | Q_OBJECT 54 | public: 55 | ~RouteSubscription(); 56 | 57 | QString route() const; 58 | 59 | Q_SIGNALS: 60 | void received(const RoutedMessage &message); 61 | 62 | private Q_SLOTS: 63 | void routeMessage(const Message &message); 64 | 65 | private: 66 | friend class Router; 67 | 68 | explicit RouteSubscription(Router *parent = nullptr); 69 | void setRoute(const QString &route); 70 | 71 | QPointer _client; 72 | QString _topic; 73 | QRegularExpression _regularExpression; 74 | QStringList _parameterNames; 75 | }; 76 | 77 | } // namespace QMQTT 78 | 79 | #endif // QMQTT_ROUTESUBSCRIPTION_H 80 | -------------------------------------------------------------------------------- /src/mqtt/qmqtt_socket_p.h: -------------------------------------------------------------------------------- 1 | /* 2 | * qmqtt_socket_p.h - qmqtt socket private header 3 | * 4 | * Copyright (c) 2013 Ery Lee 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 10 | * * Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * * Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * * Neither the name of mqttc nor the names of its contributors may be used 16 | * to endorse or promote products derived from this software without 17 | * specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | #ifndef QMQTT_SOCKET_P_H 33 | #define QMQTT_SOCKET_P_H 34 | 35 | #include 36 | 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | 43 | QT_FORWARD_DECLARE_CLASS(QIODevice) 44 | QT_FORWARD_DECLARE_CLASS(QTcpSocket) 45 | 46 | namespace QMQTT 47 | { 48 | 49 | class Socket : public SocketInterface 50 | { 51 | Q_OBJECT 52 | public: 53 | explicit Socket(QObject* parent = nullptr); 54 | virtual ~Socket(); 55 | 56 | virtual QIODevice *ioDevice(); 57 | void connectToHost(const QHostAddress& address, quint16 port); 58 | void connectToHost(const QString& hostName, quint16 port); 59 | void disconnectFromHost(); 60 | QAbstractSocket::SocketState state() const; 61 | QAbstractSocket::SocketError error() const; 62 | 63 | protected: 64 | QScopedPointer _socket; 65 | }; 66 | 67 | } 68 | 69 | #endif // QMQTT_SOCKET_P_H 70 | -------------------------------------------------------------------------------- /src/mqtt/qmqtt_timer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * qmqtt_timer.cpp - qmqtt timer 3 | * 4 | * Copyright (c) 2013 Ery Lee 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 10 | * * Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * * Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * * Neither the name of mqttc nor the names of its contributors may be used 16 | * to endorse or promote products derived from this software without 17 | * specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | 33 | #include "qmqtt_timer_p.h" 34 | 35 | QMQTT::Timer::Timer(QObject* parent) 36 | : TimerInterface(parent) 37 | { 38 | connect(&_timer, &QTimer::timeout, this, &TimerInterface::timeout); 39 | } 40 | 41 | QMQTT::Timer::~Timer() 42 | { 43 | } 44 | 45 | bool QMQTT::Timer::isSingleShot() const 46 | { 47 | return _timer.isSingleShot(); 48 | } 49 | 50 | void QMQTT::Timer::setSingleShot(bool singleShot) 51 | { 52 | _timer.setSingleShot(singleShot); 53 | } 54 | 55 | int QMQTT::Timer::interval() const 56 | { 57 | return _timer.interval(); 58 | } 59 | 60 | void QMQTT::Timer::setInterval(int msec) 61 | { 62 | _timer.setInterval(msec); 63 | } 64 | 65 | void QMQTT::Timer::start() 66 | { 67 | _timer.start(); 68 | } 69 | 70 | void QMQTT::Timer::stop() 71 | { 72 | _timer.stop(); 73 | } 74 | -------------------------------------------------------------------------------- /src/mqtt/qmqtt_timer_p.h: -------------------------------------------------------------------------------- 1 | /* 2 | * qmqtt_timer_p.h - qmqtt timer private header 3 | * 4 | * Copyright (c) 2013 Ery Lee 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 10 | * * Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * * Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * * Neither the name of mqttc nor the names of its contributors may be used 16 | * to endorse or promote products derived from this software without 17 | * specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | #ifndef QMQTT_TIMER_P_H 33 | #define QMQTT_TIMER_P_H 34 | 35 | #include 36 | 37 | #include 38 | #include 39 | 40 | namespace QMQTT { 41 | 42 | class Timer : public TimerInterface 43 | { 44 | Q_OBJECT 45 | public: 46 | explicit Timer(QObject *parent = nullptr); 47 | virtual ~Timer(); 48 | 49 | bool isSingleShot() const; 50 | void setSingleShot(bool singleShot); 51 | int interval() const; 52 | void setInterval(int msec); 53 | void start(); 54 | void stop(); 55 | 56 | protected: 57 | QTimer _timer; 58 | }; 59 | 60 | } 61 | 62 | #endif // QMQTT_TIMER_P_H 63 | -------------------------------------------------------------------------------- /src/mqtt/qmqtt_timerinterface.h: -------------------------------------------------------------------------------- 1 | /* 2 | * qmqtt_timerinterface.h - qmqtt timer interface header 3 | * 4 | * Copyright (c) 2013 Ery Lee 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 10 | * * Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * * Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * * Neither the name of mqttc nor the names of its contributors may be used 16 | * to endorse or promote products derived from this software without 17 | * specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | #ifndef QMQTT_TIMER_INTERFACE_H 33 | #define QMQTT_TIMER_INTERFACE_H 34 | 35 | #include 36 | 37 | #include 38 | 39 | namespace QMQTT { 40 | 41 | class Q_MQTT_EXPORT TimerInterface : public QObject 42 | { 43 | Q_OBJECT 44 | public: 45 | explicit TimerInterface(QObject* parent = nullptr) : QObject(parent) {} 46 | virtual ~TimerInterface() {} 47 | 48 | virtual bool isSingleShot() const = 0; 49 | virtual void setSingleShot(bool singleShot) = 0; 50 | virtual int interval() const = 0; 51 | virtual void setInterval(int msec) = 0; 52 | virtual void start() = 0; 53 | virtual void stop() = 0; 54 | 55 | Q_SIGNALS: 56 | void timeout(); 57 | }; 58 | 59 | } 60 | 61 | #endif // QMQTT_TIMER_INTERFACE_H 62 | 63 | -------------------------------------------------------------------------------- /src/mqtt/qmqtt_websocketiodevice.cpp: -------------------------------------------------------------------------------- 1 | #ifdef QT_WEBSOCKETS_LIB 2 | 3 | #include "qmqtt_websocketiodevice_p.h" 4 | 5 | #include 6 | 7 | QMQTT::WebSocketIODevice::WebSocketIODevice(QWebSocket *socket, QObject *parent) 8 | : QIODevice(parent) 9 | , _webSocket(socket) 10 | { 11 | connect(_webSocket, &QWebSocket::bytesWritten, this, &WebSocketIODevice::bytesWritten); 12 | connect(_webSocket, &QWebSocket::binaryMessageReceived, 13 | this, &WebSocketIODevice::binaryMessageReceived); 14 | } 15 | 16 | bool QMQTT::WebSocketIODevice::connectToHost(const QNetworkRequest &request) 17 | { 18 | _webSocket->open(request); 19 | return QIODevice::open(QIODevice::ReadWrite); 20 | } 21 | 22 | qint64 QMQTT::WebSocketIODevice::bytesAvailable() const 23 | { 24 | return _buffer.count(); 25 | } 26 | 27 | void QMQTT::WebSocketIODevice::binaryMessageReceived(const QByteArray &frame) 28 | { 29 | _buffer.append(frame); 30 | emit readyRead(); 31 | } 32 | 33 | qint64 QMQTT::WebSocketIODevice::readData(char *data, qint64 maxSize) 34 | { 35 | int size = qMin(static_cast(maxSize), _buffer.count()); 36 | for (int i=0; i(maxSize)); 45 | return _webSocket->sendBinaryMessage(d); 46 | } 47 | 48 | #endif // QT_WEBSOCKETS_LIB 49 | -------------------------------------------------------------------------------- /src/mqtt/qmqtt_websocketiodevice_p.h: -------------------------------------------------------------------------------- 1 | /* 2 | * qmqtt_socketinterface.h - qmqtt socket interface header 3 | * 4 | * Copyright (c) 2013 Ery Lee 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 10 | * * Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * * Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * * Neither the name of mqttc nor the names of its contributors may be used 16 | * to endorse or promote products derived from this software without 17 | * specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | 33 | #ifndef QMQTT_WEBSOCKETIODEVICE_H 34 | #define QMQTT_WEBSOCKETIODEVICE_H 35 | 36 | #ifdef QT_WEBSOCKETS_LIB 37 | 38 | #include 39 | #include 40 | 41 | QT_FORWARD_DECLARE_CLASS(QWebSocket) 42 | QT_FORWARD_DECLARE_CLASS(QNetworkRequest) 43 | 44 | namespace QMQTT 45 | { 46 | 47 | class WebSocketIODevice : public QIODevice 48 | { 49 | Q_OBJECT 50 | public: 51 | explicit WebSocketIODevice(QWebSocket *socket, QObject *parent = nullptr); 52 | 53 | bool connectToHost(const QNetworkRequest &request); 54 | 55 | virtual qint64 bytesAvailable() const; 56 | 57 | protected: 58 | virtual qint64 readData(char *data, qint64 maxSize); 59 | 60 | virtual qint64 writeData(const char *data, qint64 maxSize); 61 | 62 | private Q_SLOTS: 63 | void binaryMessageReceived(const QByteArray &frame); 64 | 65 | private: 66 | QByteArray _buffer; 67 | QWebSocket *_webSocket; 68 | }; 69 | 70 | } 71 | 72 | #endif // QT_WEBSOCKETS_LIB 73 | 74 | #endif // QMQTT_WEBSOCKETIODEVICE_H 75 | -------------------------------------------------------------------------------- /src/src.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | SUBDIRS += \ 3 | mqtt/qmqtt.pro 4 | -------------------------------------------------------------------------------- /src/src.qbs: -------------------------------------------------------------------------------- 1 | import qbs 2 | 3 | Project { 4 | name: "Sources" 5 | 6 | references: [ 7 | "mqtt/qmqtt.qbs" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /sync.profile: -------------------------------------------------------------------------------- 1 | %modules = ( # path to module name map 2 | "QtQmqtt" => "$basedir/src/mqtt", 3 | ); 4 | %moduleheaders = ( # restrict the module headers to those found in relative path 5 | ); 6 | # Module dependencies. 7 | # Every module that is required to build this module should have one entry. 8 | # Each of the module version specifiers can take one of the following values: 9 | # - A specific Git revision. 10 | # - any git symbolic ref resolvable from the module's repository (e.g. "refs/heads/master" to track master branch) 11 | # - an empty string to use the same branch under test (dependencies will become "refs/heads/master" if we are in the master branch) 12 | # 13 | %dependencies = ( 14 | "qtbase" => "", 15 | ); 16 | -------------------------------------------------------------------------------- /tests/auto/auto.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | 3 | SUBDIRS += \ 4 | cmake 5 | -------------------------------------------------------------------------------- /tests/auto/auto.qbs: -------------------------------------------------------------------------------- 1 | import qbs 2 | 3 | Project { 4 | name: "Auto" 5 | 6 | references: [ 7 | "cmake" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /tests/auto/cmake/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8) 2 | 3 | project(qmake_cmake_files) 4 | 5 | enable_testing() 6 | 7 | find_package(Qt5Core REQUIRED) 8 | find_package(Qt5Network REQUIRED) 9 | 10 | include("${_Qt5CTestMacros}") 11 | 12 | test_module_includes( 13 | QMQTT qmqtt_message.h 14 | ) 15 | -------------------------------------------------------------------------------- /tests/auto/cmake/cmake.pro: -------------------------------------------------------------------------------- 1 | 2 | # Cause make to do nothing. 3 | TEMPLATE = subdirs 4 | 5 | CMAKE_QT_MODULES_UNDER_TEST = qmqtt 6 | 7 | CONFIG += ctest_testcase 8 | -------------------------------------------------------------------------------- /tests/auto/cmake/cmake.qbs: -------------------------------------------------------------------------------- 1 | import qbs 2 | 3 | /* TODO: add cmake test */ 4 | Product { 5 | name: "CMake" 6 | } 7 | -------------------------------------------------------------------------------- /tests/benchmarks/benchmarks.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | SUBDIRS += \ 3 | message 4 | -------------------------------------------------------------------------------- /tests/benchmarks/message/message.pro: -------------------------------------------------------------------------------- 1 | TARGET = tst_bench_message 2 | QT += testlib 3 | QT += qmqtt 4 | QT -= gui 5 | 6 | CONFIG += release 7 | 8 | SOURCES += main.cpp 9 | -------------------------------------------------------------------------------- /tests/gtest/gtest.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | SUBDIRS += gtest tests 3 | tests.depends = gtest 4 | -------------------------------------------------------------------------------- /tests/gtest/gtest.qbs: -------------------------------------------------------------------------------- 1 | import qbs 2 | 3 | Project { 4 | name: "GTest" 5 | property bool runUnitTests: true 6 | 7 | references: [ 8 | "gtest", 9 | "tests", 10 | ] 11 | 12 | AutotestRunner { 13 | condition: runUnitTests && qbs.targetOS.contains("unix") 14 | 15 | Properties { 16 | condition: qbs.targetOS.contains("macx") 17 | 18 | /* TODO: if needed, add "install_name_tool" usage */ 19 | } 20 | 21 | Depends { 22 | name: "Google-Test" 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/.travis.yml: -------------------------------------------------------------------------------- 1 | # Build matrix / environment variable are explained on: 2 | # http://about.travis-ci.org/docs/user/build-configuration/ 3 | # This file can be validated on: 4 | # http://lint.travis-ci.org/ 5 | 6 | install: 7 | # /usr/bin/gcc is 4.6 always, but gcc-X.Y is available. 8 | - if [ "$CXX" = "g++" ]; then export CXX="g++-4.9" CC="gcc-4.9"; fi 9 | # /usr/bin/clang is 3.4, lets override with modern one. 10 | - if [ "$CXX" = "clang++" ] && [ "$TRAVIS_OS_NAME" = "linux" ]; then export CXX="clang++-3.7" CC="clang-3.7"; fi 11 | - echo ${PATH} 12 | - echo ${CXX} 13 | - ${CXX} --version 14 | - ${CXX} -v 15 | addons: 16 | apt: 17 | # List of whitelisted in travis packages for ubuntu-precise can be found here: 18 | # https://github.com/travis-ci/apt-package-whitelist/blob/master/ubuntu-precise 19 | # List of whitelisted in travis apt-sources: 20 | # https://github.com/travis-ci/apt-source-whitelist/blob/master/ubuntu.json 21 | sources: 22 | - ubuntu-toolchain-r-test 23 | - llvm-toolchain-precise-3.7 24 | packages: 25 | - gcc-4.9 26 | - g++-4.9 27 | - clang-3.7 28 | - valgrind 29 | os: 30 | - linux 31 | - osx 32 | language: cpp 33 | compiler: 34 | - gcc 35 | - clang 36 | script: ./travis.sh 37 | env: 38 | matrix: 39 | - GTEST_TARGET=googletest SHARED_LIB=OFF STATIC_LIB=ON CMAKE_PKG=OFF BUILD_TYPE=debug VERBOSE_MAKE=true VERBOSE 40 | - GTEST_TARGET=googlemock SHARED_LIB=OFF STATIC_LIB=ON CMAKE_PKG=OFF BUILD_TYPE=debug VERBOSE_MAKE=true VERBOSE 41 | - GTEST_TARGET=googlemock SHARED_LIB=OFF STATIC_LIB=ON CMAKE_PKG=OFF BUILD_TYPE=debug CXX_FLAGS=-std=c++11 VERBOSE_MAKE=true VERBOSE 42 | # - GTEST_TARGET=googletest SHARED_LIB=ON STATIC_LIB=ON CMAKE_PKG=ON BUILD_TYPE=release VERBOSE_MAKE=false 43 | # - GTEST_TARGET=googlemock SHARED_LIB=ON STATIC_LIB=ON CMAKE_PKG=ON BUILD_TYPE=release VERBOSE_MAKE=false 44 | notifications: 45 | email: false 46 | sudo: false 47 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6.2) 2 | 3 | project( googletest-distribution ) 4 | 5 | enable_testing() 6 | 7 | option(BUILD_GTEST "Builds the googletest subproject" OFF) 8 | 9 | #Note that googlemock target already builds googletest 10 | option(BUILD_GMOCK "Builds the googlemock subproject" ON) 11 | 12 | if(BUILD_GMOCK) 13 | add_subdirectory( googlemock ) 14 | elseif(BUILD_GTEST) 15 | add_subdirectory( googletest ) 16 | endif() 17 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googlemock/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This file contains a list of people who've made non-trivial 2 | # contribution to the Google C++ Mocking Framework project. People 3 | # who commit code to the project are encouraged to add their names 4 | # here. Please keep the list sorted by first names. 5 | 6 | Benoit Sigoure 7 | Bogdan Piloca 8 | Chandler Carruth 9 | Dave MacLachlan 10 | David Anderson 11 | Dean Sturtevant 12 | Gene Volovich 13 | Hal Burch 14 | Jeffrey Yasskin 15 | Jim Keller 16 | Joe Walnes 17 | Jon Wray 18 | Keir Mierle 19 | Keith Ray 20 | Kostya Serebryany 21 | Lev Makhlis 22 | Manuel Klimek 23 | Mario Tanev 24 | Mark Paskin 25 | Markus Heule 26 | Matthew Simmons 27 | Mike Bland 28 | Neal Norwitz 29 | Nermin Ozkiranartli 30 | Owen Carlsen 31 | Paneendra Ba 32 | Paul Menage 33 | Piotr Kaminski 34 | Russ Rufer 35 | Sverre Sundsdal 36 | Takeshi Yoshino 37 | Vadim Berman 38 | Vlad Losev 39 | Wolfgang Klier 40 | Zhanyong Wan 41 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googlemock/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2008, Google Inc. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above 11 | copyright notice, this list of conditions and the following disclaimer 12 | in the documentation and/or other materials provided with the 13 | distribution. 14 | * Neither the name of Google Inc. nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googlemock/build-aux/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/qmqtt/39c3e8af25407e25590b511c1e9387deabe89bac/tests/gtest/gtest/googletest/googlemock/build-aux/.keep -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googlemock/docs/Documentation.md: -------------------------------------------------------------------------------- 1 | This page lists all documentation wiki pages for Google Mock **(the SVN trunk version)** 2 | - **if you use a released version of Google Mock, please read the documentation for that specific version instead.** 3 | 4 | * [ForDummies](ForDummies.md) -- start here if you are new to Google Mock. 5 | * [CheatSheet](CheatSheet.md) -- a quick reference. 6 | * [CookBook](CookBook.md) -- recipes for doing various tasks using Google Mock. 7 | * [FrequentlyAskedQuestions](FrequentlyAskedQuestions.md) -- check here before asking a question on the mailing list. 8 | 9 | To contribute code to Google Mock, read: 10 | 11 | * [DevGuide](DevGuide.md) -- read this _before_ writing your first patch. 12 | * [Pump Manual](../googletest/docs/PumpManual.md) -- how we generate some of Google Mock's source files. 13 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googlemock/docs/KnownIssues.md: -------------------------------------------------------------------------------- 1 | As any non-trivial software system, Google Mock has some known limitations and problems. We are working on improving it, and welcome your help! The follow is a list of issues we know about. 2 | 3 | 4 | 5 | ## README contains outdated information on Google Mock's compatibility with other testing frameworks ## 6 | 7 | The `README` file in release 1.1.0 still says that Google Mock only works with Google Test. Actually, you can configure Google Mock to work with any testing framework you choose. 8 | 9 | ## Tests failing on machines using Power PC CPUs (e.g. some Macs) ## 10 | 11 | `gmock_output_test` and `gmock-printers_test` are known to fail with Power PC CPUs. This is due to portability issues with these tests, and is not an indication of problems in Google Mock itself. You can safely ignore them. 12 | 13 | ## Failed to resolve libgtest.so.0 in tests when built against installed Google Test ## 14 | 15 | This only applies if you manually built and installed Google Test, and then built a Google Mock against it (either explicitly, or because gtest-config was in your path post-install). In this situation, Libtool has a known issue with certain systems' ldconfig setup: 16 | 17 | http://article.gmane.org/gmane.comp.sysutils.automake.general/9025 18 | 19 | This requires a manual run of "sudo ldconfig" after the "sudo make install" for Google Test before any binaries which link against it can be executed. This isn't a bug in our install, but we should at least have documented it or hacked a work-around into our install. We should have one of these solutions in our next release. -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googlemock/docs/v1_5/Documentation.md: -------------------------------------------------------------------------------- 1 | This page lists all documentation wiki pages for Google Mock **version 1.5.0** -- **if you use a different version of Google Mock, please read the documentation for that specific version instead.** 2 | 3 | * [ForDummies](V1_5_ForDummies.md) -- start here if you are new to Google Mock. 4 | * [CheatSheet](V1_5_CheatSheet.md) -- a quick reference. 5 | * [CookBook](V1_5_CookBook.md) -- recipes for doing various tasks using Google Mock. 6 | * [FrequentlyAskedQuestions](V1_5_FrequentlyAskedQuestions.md) -- check here before asking a question on the mailing list. 7 | 8 | To contribute code to Google Mock, read: 9 | 10 | * DevGuide -- read this _before_ writing your first patch. 11 | * [Pump Manual](http://code.google.com/p/googletest/wiki/PumpManual) -- how we generate some of Google Mock's source files. -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googlemock/docs/v1_6/Documentation.md: -------------------------------------------------------------------------------- 1 | This page lists all documentation wiki pages for Google Mock **1.6** 2 | - **if you use a released version of Google Mock, please read the documentation for that specific version instead.** 3 | 4 | * [ForDummies](V1_6_ForDummies.md) -- start here if you are new to Google Mock. 5 | * [CheatSheet](V1_6_CheatSheet.md) -- a quick reference. 6 | * [CookBook](V1_6_CookBook.md) -- recipes for doing various tasks using Google Mock. 7 | * [FrequentlyAskedQuestions](V1_6_FrequentlyAskedQuestions.md) -- check here before asking a question on the mailing list. 8 | 9 | To contribute code to Google Mock, read: 10 | 11 | * [DevGuide](DevGuide.md) -- read this _before_ writing your first patch. 12 | * [Pump Manual](http://code.google.com/p/googletest/wiki/V1_6_PumpManual) -- how we generate some of Google Mock's source files. -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googlemock/docs/v1_7/Documentation.md: -------------------------------------------------------------------------------- 1 | This page lists all documentation wiki pages for Google Mock **(the SVN trunk version)** 2 | - **if you use a released version of Google Mock, please read the documentation for that specific version instead.** 3 | 4 | * [ForDummies](V1_7_ForDummies.md) -- start here if you are new to Google Mock. 5 | * [CheatSheet](V1_7_CheatSheet.md) -- a quick reference. 6 | * [CookBook](V1_7_CookBook.md) -- recipes for doing various tasks using Google Mock. 7 | * [FrequentlyAskedQuestions](V1_7_FrequentlyAskedQuestions.md) -- check here before asking a question on the mailing list. 8 | 9 | To contribute code to Google Mock, read: 10 | 11 | * [DevGuide](DevGuide.md) -- read this _before_ writing your first patch. 12 | * [Pump Manual](http://code.google.com/p/googletest/wiki/PumpManual) -- how we generate some of Google Mock's source files. -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googlemock/include/gmock/gmock-more-matchers.h: -------------------------------------------------------------------------------- 1 | // Copyright 2013, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: marcus.boerger@google.com (Marcus Boerger) 31 | 32 | // Google Mock - a framework for writing C++ mock classes. 33 | // 34 | // This file implements some matchers that depend on gmock-generated-matchers.h. 35 | // 36 | // Note that tests are implemented in gmock-matchers_test.cc rather than 37 | // gmock-more-matchers-test.cc. 38 | 39 | #ifndef GMOCK_GMOCK_MORE_MATCHERS_H_ 40 | #define GMOCK_GMOCK_MORE_MATCHERS_H_ 41 | 42 | #include "gmock/gmock-generated-matchers.h" 43 | 44 | namespace testing { 45 | 46 | // Defines a matcher that matches an empty container. The container must 47 | // support both size() and empty(), which all STL-like containers provide. 48 | MATCHER(IsEmpty, negation ? "isn't empty" : "is empty") { 49 | if (arg.empty()) { 50 | return true; 51 | } 52 | *result_listener << "whose size is " << arg.size(); 53 | return false; 54 | } 55 | 56 | } // namespace testing 57 | 58 | #endif // GMOCK_GMOCK_MORE_MATCHERS_H_ 59 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h: -------------------------------------------------------------------------------- 1 | // This file was GENERATED by command: 2 | // pump.py gmock-generated-actions.h.pump 3 | // DO NOT EDIT BY HAND!!! 4 | 5 | #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ 6 | #define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ 7 | 8 | #endif // GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ 9 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h.pump: -------------------------------------------------------------------------------- 1 | $$ -*- mode: c++; -*- 2 | $$ This is a Pump source file (http://go/pump). Please use Pump to convert 3 | $$ it to callback-actions.h. 4 | $$ 5 | $var max_callback_arity = 5 6 | $$}} This meta comment fixes auto-indentation in editors. 7 | #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ 8 | #define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ 9 | 10 | #endif // GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ 11 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googlemock/include/gmock/internal/custom/gmock-matchers.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // ============================================================ 31 | // An installation-specific extension point for gmock-matchers.h. 32 | // ============================================================ 33 | // 34 | // Adds google3 callback support to CallableTraits. 35 | // 36 | #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_CALLBACK_MATCHERS_H_ 37 | #define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_CALLBACK_MATCHERS_H_ 38 | 39 | #endif // GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_CALLBACK_MATCHERS_H_ 40 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googlemock/include/gmock/internal/custom/gmock-port.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Injection point for custom user configurations. 31 | // The following macros can be defined: 32 | // 33 | // Flag related macros: 34 | // GMOCK_DECLARE_bool_(name) 35 | // GMOCK_DECLARE_int32_(name) 36 | // GMOCK_DECLARE_string_(name) 37 | // GMOCK_DEFINE_bool_(name, default_val, doc) 38 | // GMOCK_DEFINE_int32_(name, default_val, doc) 39 | // GMOCK_DEFINE_string_(name, default_val, doc) 40 | // 41 | // ** Custom implementation starts here ** 42 | 43 | #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_ 44 | #define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_ 45 | 46 | #endif // GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_ 47 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googlemock/msvc/2005/gmock.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 9.00 3 | # Visual Studio 2005 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gmock", "gmock.vcproj", "{34681F0D-CE45-415D-B5F2-5C662DFE3BD5}" 5 | EndProject 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gmock_test", "gmock_test.vcproj", "{F10D22F8-AC7B-4213-8720-608E7D878CD2}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gmock_main", "gmock_main.vcproj", "{E4EF614B-30DF-4954-8C53-580A0BF6B589}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Win32 = Debug|Win32 13 | Release|Win32 = Release|Win32 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {34681F0D-CE45-415D-B5F2-5C662DFE3BD5}.Debug|Win32.ActiveCfg = Debug|Win32 17 | {34681F0D-CE45-415D-B5F2-5C662DFE3BD5}.Debug|Win32.Build.0 = Debug|Win32 18 | {34681F0D-CE45-415D-B5F2-5C662DFE3BD5}.Release|Win32.ActiveCfg = Release|Win32 19 | {34681F0D-CE45-415D-B5F2-5C662DFE3BD5}.Release|Win32.Build.0 = Release|Win32 20 | {F10D22F8-AC7B-4213-8720-608E7D878CD2}.Debug|Win32.ActiveCfg = Debug|Win32 21 | {F10D22F8-AC7B-4213-8720-608E7D878CD2}.Debug|Win32.Build.0 = Debug|Win32 22 | {F10D22F8-AC7B-4213-8720-608E7D878CD2}.Release|Win32.ActiveCfg = Release|Win32 23 | {F10D22F8-AC7B-4213-8720-608E7D878CD2}.Release|Win32.Build.0 = Release|Win32 24 | {E4EF614B-30DF-4954-8C53-580A0BF6B589}.Debug|Win32.ActiveCfg = Debug|Win32 25 | {E4EF614B-30DF-4954-8C53-580A0BF6B589}.Debug|Win32.Build.0 = Debug|Win32 26 | {E4EF614B-30DF-4954-8C53-580A0BF6B589}.Release|Win32.ActiveCfg = Release|Win32 27 | {E4EF614B-30DF-4954-8C53-580A0BF6B589}.Release|Win32.Build.0 = Release|Win32 28 | EndGlobalSection 29 | GlobalSection(SolutionProperties) = preSolution 30 | HideSolutionNode = FALSE 31 | EndGlobalSection 32 | EndGlobal 33 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googlemock/msvc/2005/gmock_config.vsprops: -------------------------------------------------------------------------------- 1 | 2 | 7 | 11 | 15 | 16 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googlemock/msvc/2010/gmock.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual C++ Express 2010 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gmock", "gmock.vcxproj", "{34681F0D-CE45-415D-B5F2-5C662DFE3BD5}" 5 | EndProject 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gmock_test", "gmock_test.vcxproj", "{F10D22F8-AC7B-4213-8720-608E7D878CD2}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gmock_main", "gmock_main.vcxproj", "{E4EF614B-30DF-4954-8C53-580A0BF6B589}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Win32 = Debug|Win32 13 | Release|Win32 = Release|Win32 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {34681F0D-CE45-415D-B5F2-5C662DFE3BD5}.Debug|Win32.ActiveCfg = Debug|Win32 17 | {34681F0D-CE45-415D-B5F2-5C662DFE3BD5}.Debug|Win32.Build.0 = Debug|Win32 18 | {34681F0D-CE45-415D-B5F2-5C662DFE3BD5}.Release|Win32.ActiveCfg = Release|Win32 19 | {34681F0D-CE45-415D-B5F2-5C662DFE3BD5}.Release|Win32.Build.0 = Release|Win32 20 | {F10D22F8-AC7B-4213-8720-608E7D878CD2}.Debug|Win32.ActiveCfg = Debug|Win32 21 | {F10D22F8-AC7B-4213-8720-608E7D878CD2}.Debug|Win32.Build.0 = Debug|Win32 22 | {F10D22F8-AC7B-4213-8720-608E7D878CD2}.Release|Win32.ActiveCfg = Release|Win32 23 | {F10D22F8-AC7B-4213-8720-608E7D878CD2}.Release|Win32.Build.0 = Release|Win32 24 | {E4EF614B-30DF-4954-8C53-580A0BF6B589}.Debug|Win32.ActiveCfg = Debug|Win32 25 | {E4EF614B-30DF-4954-8C53-580A0BF6B589}.Debug|Win32.Build.0 = Debug|Win32 26 | {E4EF614B-30DF-4954-8C53-580A0BF6B589}.Release|Win32.ActiveCfg = Release|Win32 27 | {E4EF614B-30DF-4954-8C53-580A0BF6B589}.Release|Win32.Build.0 = Release|Win32 28 | EndGlobalSection 29 | GlobalSection(SolutionProperties) = preSolution 30 | HideSolutionNode = FALSE 31 | EndGlobalSection 32 | EndGlobal 33 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googlemock/msvc/2010/gmock_config.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ../../gtest 5 | 6 | 7 | <_ProjectFileVersion>10.0.30319.1 8 | 9 | 10 | 11 | $(GTestDir)/include;%(AdditionalIncludeDirectories) 12 | 13 | 14 | 15 | 16 | $(GTestDir) 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googlemock/scripts/generator/README: -------------------------------------------------------------------------------- 1 | 2 | The Google Mock class generator is an application that is part of cppclean. 3 | For more information about cppclean, see the README.cppclean file or 4 | visit http://code.google.com/p/cppclean/ 5 | 6 | cppclean requires Python 2.3.5 or later. If you don't have Python installed 7 | on your system, you will also need to install it. You can download Python 8 | from: http://www.python.org/download/releases/ 9 | 10 | To use the Google Mock class generator, you need to call it 11 | on the command line passing the header file and class for which you want 12 | to generate a Google Mock class. 13 | 14 | Make sure to install the scripts somewhere in your path. Then you can 15 | run the program. 16 | 17 | gmock_gen.py header-file.h [ClassName]... 18 | 19 | If no ClassNames are specified, all classes in the file are emitted. 20 | 21 | To change the indentation from the default of 2, set INDENT in 22 | the environment. For example to use an indent of 4 spaces: 23 | 24 | INDENT=4 gmock_gen.py header-file.h ClassName 25 | 26 | This version was made from SVN revision 281 in the cppclean repository. 27 | 28 | Known Limitations 29 | ----------------- 30 | Not all code will be generated properly. For example, when mocking templated 31 | classes, the template information is lost. You will need to add the template 32 | information manually. 33 | 34 | Not all permutations of using multiple pointers/references will be rendered 35 | properly. These will also have to be fixed manually. 36 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googlemock/scripts/generator/cpp/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/qmqtt/39c3e8af25407e25590b511c1e9387deabe89bac/tests/gtest/gtest/googletest/googlemock/scripts/generator/cpp/__init__.py -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googlemock/scripts/generator/cpp/keywords.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Copyright 2007 Neal Norwitz 4 | # Portions Copyright 2007 Google Inc. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | """C++ keywords and helper utilities for determining keywords.""" 19 | 20 | __author__ = 'nnorwitz@google.com (Neal Norwitz)' 21 | 22 | 23 | try: 24 | # Python 3.x 25 | import builtins 26 | except ImportError: 27 | # Python 2.x 28 | import __builtin__ as builtins 29 | 30 | 31 | if not hasattr(builtins, 'set'): 32 | # Nominal support for Python 2.3. 33 | from sets import Set as set 34 | 35 | 36 | TYPES = set('bool char int long short double float void wchar_t unsigned signed'.split()) 37 | TYPE_MODIFIERS = set('auto register const inline extern static virtual volatile mutable'.split()) 38 | ACCESS = set('public protected private friend'.split()) 39 | 40 | CASTS = set('static_cast const_cast dynamic_cast reinterpret_cast'.split()) 41 | 42 | OTHERS = set('true false asm class namespace using explicit this operator sizeof'.split()) 43 | OTHER_TYPES = set('new delete typedef struct union enum typeid typename template'.split()) 44 | 45 | CONTROL = set('case switch default if else return goto'.split()) 46 | EXCEPTION = set('try catch throw'.split()) 47 | LOOP = set('while do for break continue'.split()) 48 | 49 | ALL = TYPES | TYPE_MODIFIERS | ACCESS | CASTS | OTHERS | OTHER_TYPES | CONTROL | EXCEPTION | LOOP 50 | 51 | 52 | def IsKeyword(token): 53 | return token in ALL 54 | 55 | def IsBuiltinType(token): 56 | if token in ('virtual', 'inline'): 57 | # These only apply to methods, they can't be types by themselves. 58 | return False 59 | return token in TYPES or token in TYPE_MODIFIERS 60 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googlemock/scripts/generator/cpp/utils.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Copyright 2007 Neal Norwitz 4 | # Portions Copyright 2007 Google Inc. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | """Generic utilities for C++ parsing.""" 19 | 20 | __author__ = 'nnorwitz@google.com (Neal Norwitz)' 21 | 22 | 23 | import sys 24 | 25 | 26 | # Set to True to see the start/end token indices. 27 | DEBUG = True 28 | 29 | 30 | def ReadFile(filename, print_error=True): 31 | """Returns the contents of a file.""" 32 | try: 33 | fp = open(filename) 34 | try: 35 | return fp.read() 36 | finally: 37 | fp.close() 38 | except IOError: 39 | if print_error: 40 | print('Error reading %s: %s' % (filename, sys.exc_info()[1])) 41 | return None 42 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googlemock/scripts/generator/gmock_gen.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Copyright 2008 Google Inc. All Rights Reserved. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | """Driver for starting up Google Mock class generator.""" 18 | 19 | __author__ = 'nnorwitz@google.com (Neal Norwitz)' 20 | 21 | import os 22 | import sys 23 | 24 | if __name__ == '__main__': 25 | # Add the directory of this script to the path so we can import gmock_class. 26 | sys.path.append(os.path.dirname(__file__)) 27 | 28 | from cpp import gmock_class 29 | # Fix the docstring in case they require the usage. 30 | gmock_class.__doc__ = gmock_class.__doc__.replace('gmock_class.py', __file__) 31 | gmock_class.main() 32 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googlemock/src/gmock-all.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | // 32 | // Google C++ Mocking Framework (Google Mock) 33 | // 34 | // This file #includes all Google Mock implementation .cc files. The 35 | // purpose is to allow a user to build Google Mock by compiling this 36 | // file alone. 37 | 38 | // This line ensures that gmock.h can be compiled on its own, even 39 | // when it's fused. 40 | #include "gmock/gmock.h" 41 | 42 | // The following lines pull in the real gmock *.cc files. 43 | #include "src/gmock-cardinalities.cc" 44 | #include "src/gmock-internal-utils.cc" 45 | #include "src/gmock-matchers.cc" 46 | #include "src/gmock-spec-builders.cc" 47 | #include "src/gmock.cc" 48 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googlemock/src/gmock_main.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | 32 | #include 33 | #include "gmock/gmock.h" 34 | #include "gtest/gtest.h" 35 | 36 | // MS C++ compiler/linker has a bug on Windows (not on Windows CE), which 37 | // causes a link error when _tmain is defined in a static library and UNICODE 38 | // is enabled. For this reason instead of _tmain, main function is used on 39 | // Windows. See the following link to track the current status of this bug: 40 | // http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=394464 // NOLINT 41 | #if GTEST_OS_WINDOWS_MOBILE 42 | # include // NOLINT 43 | 44 | GTEST_API_ int _tmain(int argc, TCHAR** argv) { 45 | #else 46 | GTEST_API_ int main(int argc, char** argv) { 47 | #endif // GTEST_OS_WINDOWS_MOBILE 48 | std::cout << "Running main() from gmock_main.cc\n"; 49 | // Since Google Mock depends on Google Test, InitGoogleMock() is 50 | // also responsible for initializing Google Test. Therefore there's 51 | // no need for calling testing::InitGoogleTest() separately. 52 | testing::InitGoogleMock(&argc, argv); 53 | return RUN_ALL_TESTS(); 54 | } 55 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googlemock/test/gmock-port_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: vladl@google.com (Vlad Losev) 31 | 32 | // Google Mock - a framework for writing C++ mock classes. 33 | // 34 | // This file tests the internal cross-platform support utilities. 35 | 36 | #include "gmock/internal/gmock-port.h" 37 | #include "gtest/gtest.h" 38 | 39 | // NOTE: if this file is left without tests for some reason, put a dummy 40 | // test here to make references to symbols in the gtest library and avoid 41 | // 'undefined symbol' linker errors in gmock_main: 42 | 43 | TEST(DummyTest, Dummy) {} 44 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googlemock/test/gmock_all_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2009, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | // 32 | // Tests for Google C++ Mocking Framework (Google Mock) 33 | // 34 | // Some users use a build system that Google Mock doesn't support directly, 35 | // yet they still want to build and run Google Mock's own tests. This file 36 | // includes most such tests, making it easier for these users to maintain 37 | // their build scripts (they just need to build this file, even though the 38 | // below list of actual *_test.cc files might change). 39 | #include "test/gmock-actions_test.cc" 40 | #include "test/gmock-cardinalities_test.cc" 41 | #include "test/gmock-generated-actions_test.cc" 42 | #include "test/gmock-generated-function-mockers_test.cc" 43 | #include "test/gmock-generated-internal-utils_test.cc" 44 | #include "test/gmock-generated-matchers_test.cc" 45 | #include "test/gmock-internal-utils_test.cc" 46 | #include "test/gmock-matchers_test.cc" 47 | #include "test/gmock-more-actions_test.cc" 48 | #include "test/gmock-nice-strict_test.cc" 49 | #include "test/gmock-port_test.cc" 50 | #include "test/gmock-spec-builders_test.cc" 51 | #include "test/gmock_test.cc" 52 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googlemock/test/gmock_link2_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan), vladl@google.com (Vlad Losev) 31 | 32 | // Google Mock - a framework for writing C++ mock classes. 33 | // 34 | // This file is for verifying that various Google Mock constructs do not 35 | // produce linker errors when instantiated in different translation units. 36 | // Please see gmock_link_test.h for details. 37 | 38 | #define LinkTest LinkTest2 39 | 40 | #include "test/gmock_link_test.h" 41 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googlemock/test/gmock_link_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan), vladl@google.com (Vlad Losev) 31 | 32 | // Google Mock - a framework for writing C++ mock classes. 33 | // 34 | // This file is for verifying that various Google Mock constructs do not 35 | // produce linker errors when instantiated in different translation units. 36 | // Please see gmock_link_test.h for details. 37 | 38 | #define LinkTest LinkTest1 39 | 40 | #include "test/gmock_link_test.h" 41 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This file contains a list of people who've made non-trivial 2 | # contribution to the Google C++ Testing Framework project. People 3 | # who commit code to the project are encouraged to add their names 4 | # here. Please keep the list sorted by first names. 5 | 6 | Ajay Joshi 7 | Balázs Dán 8 | Bharat Mediratta 9 | Chandler Carruth 10 | Chris Prince 11 | Chris Taylor 12 | Dan Egnor 13 | Eric Roman 14 | Hady Zalek 15 | Jeffrey Yasskin 16 | Jói Sigurðsson 17 | Keir Mierle 18 | Keith Ray 19 | Kenton Varda 20 | Manuel Klimek 21 | Markus Heule 22 | Mika Raento 23 | Miklós Fazekas 24 | Pasi Valminen 25 | Patrick Hanna 26 | Patrick Riley 27 | Peter Kaminski 28 | Preston Jackson 29 | Rainer Klaffenboeck 30 | Russ Cox 31 | Russ Rufer 32 | Sean Mcafee 33 | Sigurður Ásgeirsson 34 | Tracy Bialik 35 | Vadim Berman 36 | Vlad Losev 37 | Zhanyong Wan 38 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2008, Google Inc. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above 11 | copyright notice, this list of conditions and the following disclaimer 12 | in the documentation and/or other materials provided with the 13 | distribution. 14 | * Neither the name of Google Inc. nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/build-aux/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/qmqtt/39c3e8af25407e25590b511c1e9387deabe89bac/tests/gtest/gtest/googletest/googletest/build-aux/.keep -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/codegear/gtest.groupproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | {c1d923e0-6cba-4332-9b6f-3420acbf5091} 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | Default.Personality 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/codegear/gtest_all.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2009, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: Josh Kelley (joshkel@gmail.com) 31 | // 32 | // Google C++ Testing Framework (Google Test) 33 | // 34 | // C++Builder's IDE cannot build a static library from files with hyphens 35 | // in their name. See http://qc.codegear.com/wc/qcmain.aspx?d=70977 . 36 | // This file serves as a workaround. 37 | 38 | #include "src/gtest-all.cc" 39 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/codegear/gtest_link.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2009, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: Josh Kelley (joshkel@gmail.com) 31 | // 32 | // Google C++ Testing Framework (Google Test) 33 | // 34 | // Links gtest.lib and gtest_main.lib into the current project in C++Builder. 35 | // This means that these libraries can't be renamed, but it's the only way to 36 | // ensure that Debug versus Release test builds are linked against the 37 | // appropriate Debug or Release build of the libraries. 38 | 39 | #pragma link "gtest.lib" 40 | #pragma link "gtest_main.lib" 41 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/configure.ac: -------------------------------------------------------------------------------- 1 | m4_include(m4/acx_pthread.m4) 2 | 3 | # At this point, the Xcode project assumes the version string will be three 4 | # integers separated by periods and surrounded by square brackets (e.g. 5 | # "[1.0.1]"). It also asumes that there won't be any closing parenthesis 6 | # between "AC_INIT(" and the closing ")" including comments and strings. 7 | AC_INIT([Google C++ Testing Framework], 8 | [1.7.0], 9 | [googletestframework@googlegroups.com], 10 | [gtest]) 11 | 12 | # Provide various options to initialize the Autoconf and configure processes. 13 | AC_PREREQ([2.59]) 14 | AC_CONFIG_SRCDIR([./LICENSE]) 15 | AC_CONFIG_MACRO_DIR([m4]) 16 | AC_CONFIG_AUX_DIR([build-aux]) 17 | AC_CONFIG_HEADERS([build-aux/config.h]) 18 | AC_CONFIG_FILES([Makefile]) 19 | AC_CONFIG_FILES([scripts/gtest-config], [chmod +x scripts/gtest-config]) 20 | 21 | # Initialize Automake with various options. We require at least v1.9, prevent 22 | # pedantic complaints about package files, and enable various distribution 23 | # targets. 24 | AM_INIT_AUTOMAKE([1.9 dist-bzip2 dist-zip foreign subdir-objects]) 25 | 26 | # Check for programs used in building Google Test. 27 | AC_PROG_CC 28 | AC_PROG_CXX 29 | AC_LANG([C++]) 30 | AC_PROG_LIBTOOL 31 | 32 | # TODO(chandlerc@google.com): Currently we aren't running the Python tests 33 | # against the interpreter detected by AM_PATH_PYTHON, and so we condition 34 | # HAVE_PYTHON by requiring "python" to be in the PATH, and that interpreter's 35 | # version to be >= 2.3. This will allow the scripts to use a "/usr/bin/env" 36 | # hashbang. 37 | PYTHON= # We *do not* allow the user to specify a python interpreter 38 | AC_PATH_PROG([PYTHON],[python],[:]) 39 | AS_IF([test "$PYTHON" != ":"], 40 | [AM_PYTHON_CHECK_VERSION([$PYTHON],[2.3],[:],[PYTHON=":"])]) 41 | AM_CONDITIONAL([HAVE_PYTHON],[test "$PYTHON" != ":"]) 42 | 43 | # Configure pthreads. 44 | AC_ARG_WITH([pthreads], 45 | [AS_HELP_STRING([--with-pthreads], 46 | [use pthreads (default is yes)])], 47 | [with_pthreads=$withval], 48 | [with_pthreads=check]) 49 | 50 | have_pthreads=no 51 | AS_IF([test "x$with_pthreads" != "xno"], 52 | [ACX_PTHREAD( 53 | [], 54 | [AS_IF([test "x$with_pthreads" != "xcheck"], 55 | [AC_MSG_FAILURE( 56 | [--with-pthreads was specified, but unable to be used])])]) 57 | have_pthreads="$acx_pthread_ok"]) 58 | AM_CONDITIONAL([HAVE_PTHREADS],[test "x$have_pthreads" = "xyes"]) 59 | AC_SUBST(PTHREAD_CFLAGS) 60 | AC_SUBST(PTHREAD_LIBS) 61 | 62 | # TODO(chandlerc@google.com) Check for the necessary system headers. 63 | 64 | # TODO(chandlerc@google.com) Check the types, structures, and other compiler 65 | # and architecture characteristics. 66 | 67 | # Output the generated files. No further autoconf macros may be used. 68 | AC_OUTPUT 69 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/docs/Documentation.md: -------------------------------------------------------------------------------- 1 | This page lists all documentation wiki pages for Google Test **(the SVN trunk version)** 2 | -- **if you use a released version of Google Test, please read the 3 | documentation for that specific version instead.** 4 | 5 | * [Primer](Primer.md) -- start here if you are new to Google Test. 6 | * [Samples](Samples.md) -- learn from examples. 7 | * [AdvancedGuide](AdvancedGuide.md) -- learn more about Google Test. 8 | * [XcodeGuide](XcodeGuide.md) -- how to use Google Test in Xcode on Mac. 9 | * [Frequently-Asked Questions](FAQ.md) -- check here before asking a question on the mailing list. 10 | 11 | To contribute code to Google Test, read: 12 | 13 | * [DevGuide](DevGuide.md) -- read this _before_ writing your first patch. 14 | * [PumpManual](PumpManual.md) -- how we generate some of Google Test's source files. -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/docs/Samples.md: -------------------------------------------------------------------------------- 1 | If you're like us, you'd like to look at some Google Test sample code. The 2 | [samples folder](../samples) has a number of well-commented samples showing how to use a 3 | variety of Google Test features. 4 | 5 | * [Sample #1](../samples/sample1_unittest.cc) shows the basic steps of using Google Test to test C++ functions. 6 | * [Sample #2](../samples/sample2_unittest.cc) shows a more complex unit test for a class with multiple member functions. 7 | * [Sample #3](../samples/sample3_unittest.cc) uses a test fixture. 8 | * [Sample #4](../samples/sample4_unittest.cc) is another basic example of using Google Test. 9 | * [Sample #5](../samples/sample5_unittest.cc) teaches how to reuse a test fixture in multiple test cases by deriving sub-fixtures from it. 10 | * [Sample #6](../samples/sample6_unittest.cc) demonstrates type-parameterized tests. 11 | * [Sample #7](../samples/sample7_unittest.cc) teaches the basics of value-parameterized tests. 12 | * [Sample #8](../samples/sample8_unittest.cc) shows using `Combine()` in value-parameterized tests. 13 | * [Sample #9](../samples/sample9_unittest.cc) shows use of the listener API to modify Google Test's console output and the use of its reflection API to inspect test results. 14 | * [Sample #10](../samples/sample10_unittest.cc) shows use of the listener API to implement a primitive memory leak checker. 15 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/docs/V1_5_Documentation.md: -------------------------------------------------------------------------------- 1 | This page lists all official documentation wiki pages for Google Test **1.5.0** -- **if you use a different version of Google Test, make sure to read the documentation for that version instead.** 2 | 3 | * [Primer](V1_5_Primer.md) -- start here if you are new to Google Test. 4 | * [Samples](Samples.md) -- learn from examples. 5 | * [AdvancedGuide](V1_5_AdvancedGuide.md) -- learn more about Google Test. 6 | * [XcodeGuide](V1_5_XcodeGuide.md) -- how to use Google Test in Xcode on Mac. 7 | * [Frequently-Asked Questions](V1_5_FAQ.md) -- check here before asking a question on the mailing list. 8 | 9 | To contribute code to Google Test, read: 10 | 11 | * DevGuide -- read this _before_ writing your first patch. 12 | * [PumpManual](V1_5_PumpManual.md) -- how we generate some of Google Test's source files. -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/docs/V1_6_Documentation.md: -------------------------------------------------------------------------------- 1 | This page lists all documentation wiki pages for Google Test **1.6** 2 | -- **if you use a released version of Google Test, please read the 3 | documentation for that specific version instead.** 4 | 5 | * [Primer](V1_6_Primer.md) -- start here if you are new to Google Test. 6 | * [Samples](V1_6_Samples.md) -- learn from examples. 7 | * [AdvancedGuide](V1_6_AdvancedGuide.md) -- learn more about Google Test. 8 | * [XcodeGuide](V1_6_XcodeGuide.md) -- how to use Google Test in Xcode on Mac. 9 | * [Frequently-Asked Questions](V1_6_FAQ.md) -- check here before asking a question on the mailing list. 10 | 11 | To contribute code to Google Test, read: 12 | 13 | * [DevGuide](DevGuide.md) -- read this _before_ writing your first patch. 14 | * [PumpManual](V1_6_PumpManual.md) -- how we generate some of Google Test's source files. -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/docs/V1_6_Samples.md: -------------------------------------------------------------------------------- 1 | If you're like us, you'd like to look at some Google Test sample code. The 2 | [samples folder](../samples) has a number of well-commented samples showing how to use a 3 | variety of Google Test features. 4 | 5 | * [Sample #1](../samples/sample1_unittest.cc) shows the basic steps of using Google Test to test C++ functions. 6 | * [Sample #2](../samples/sample2_unittest.cc) shows a more complex unit test for a class with multiple member functions. 7 | * [Sample #3](../samples/sample3_unittest.cc) uses a test fixture. 8 | * [Sample #4](../samples/sample4_unittest.cc) is another basic example of using Google Test. 9 | * [Sample #5](../samples/sample5_unittest.cc) teaches how to reuse a test fixture in multiple test cases by deriving sub-fixtures from it. 10 | * [Sample #6](../samples/sample6_unittest.cc) demonstrates type-parameterized tests. 11 | * [Sample #7](../samples/sample7_unittest.cc) teaches the basics of value-parameterized tests. 12 | * [Sample #8](../samples/sample8_unittest.cc) shows using `Combine()` in value-parameterized tests. 13 | * [Sample #9](../samples/sample9_unittest.cc) shows use of the listener API to modify Google Test's console output and the use of its reflection API to inspect test results. 14 | * [Sample #10](../samples/sample10_unittest.cc) shows use of the listener API to implement a primitive memory leak checker. 15 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/docs/V1_7_Documentation.md: -------------------------------------------------------------------------------- 1 | This page lists all documentation wiki pages for Google Test **(the SVN trunk version)** 2 | -- **if you use a released version of Google Test, please read the 3 | documentation for that specific version instead.** 4 | 5 | * [Primer](V1_7_Primer.md) -- start here if you are new to Google Test. 6 | * [Samples](V1_7_Samples.md) -- learn from examples. 7 | * [AdvancedGuide](V1_7_AdvancedGuide.md) -- learn more about Google Test. 8 | * [XcodeGuide](V1_7_XcodeGuide.md) -- how to use Google Test in Xcode on Mac. 9 | * [Frequently-Asked Questions](V1_7_FAQ.md) -- check here before asking a question on the mailing list. 10 | 11 | To contribute code to Google Test, read: 12 | 13 | * [DevGuide](DevGuide.md) -- read this _before_ writing your first patch. 14 | * [PumpManual](V1_7_PumpManual.md) -- how we generate some of Google Test's source files. -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/docs/V1_7_Samples.md: -------------------------------------------------------------------------------- 1 | If you're like us, you'd like to look at some Google Test sample code. The 2 | [samples folder](../samples) has a number of well-commented samples showing how to use a 3 | variety of Google Test features. 4 | 5 | * [Sample #1](../samples/sample1_unittest.cc) shows the basic steps of using Google Test to test C++ functions. 6 | * [Sample #2](../samples/sample2_unittest.cc) shows a more complex unit test for a class with multiple member functions. 7 | * [Sample #3](../samples/sample3_unittest.cc) uses a test fixture. 8 | * [Sample #4](../samples/sample4_unittest.cc) is another basic example of using Google Test. 9 | * [Sample #5](../samples/sample5_unittest.cc) teaches how to reuse a test fixture in multiple test cases by deriving sub-fixtures from it. 10 | * [Sample #6](../samples/sample6_unittest.cc) demonstrates type-parameterized tests. 11 | * [Sample #7](../samples/sample7_unittest.cc) teaches the basics of value-parameterized tests. 12 | * [Sample #8](../samples/sample8_unittest.cc) shows using `Combine()` in value-parameterized tests. 13 | * [Sample #9](../samples/sample9_unittest.cc) shows use of the listener API to modify Google Test's console output and the use of its reflection API to inspect test results. 14 | * [Sample #10](../samples/sample10_unittest.cc) shows use of the listener API to implement a primitive memory leak checker. 15 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/include/gtest/gtest_prod.h: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | // 32 | // Google C++ Testing Framework definitions useful in production code. 33 | 34 | #ifndef GTEST_INCLUDE_GTEST_GTEST_PROD_H_ 35 | #define GTEST_INCLUDE_GTEST_GTEST_PROD_H_ 36 | 37 | // When you need to test the private or protected members of a class, 38 | // use the FRIEND_TEST macro to declare your tests as friends of the 39 | // class. For example: 40 | // 41 | // class MyClass { 42 | // private: 43 | // void MyMethod(); 44 | // FRIEND_TEST(MyClassTest, MyMethod); 45 | // }; 46 | // 47 | // class MyClassTest : public testing::Test { 48 | // // ... 49 | // }; 50 | // 51 | // TEST_F(MyClassTest, MyMethod) { 52 | // // Can call MyClass::MyMethod() here. 53 | // } 54 | 55 | #define FRIEND_TEST(test_case_name, test_name)\ 56 | friend class test_case_name##_##test_name##_Test 57 | 58 | #endif // GTEST_INCLUDE_GTEST_GTEST_PROD_H_ 59 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/include/gtest/internal/custom/gtest-printers.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // This file provides an injection point for custom printers in a local 31 | // installation of gTest. 32 | // It will be included from gtest-printers.h and the overrides in this file 33 | // will be visible to everyone. 34 | // See documentation at gtest/gtest-printers.h for details on how to define a 35 | // custom printer. 36 | // 37 | // ** Custom implementation starts here ** 38 | 39 | #ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_ 40 | #define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_ 41 | 42 | #endif // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_ 43 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/include/gtest/internal/custom/gtest.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Injection point for custom user configurations. 31 | // The following macros can be defined: 32 | // 33 | // GTEST_OS_STACK_TRACE_GETTER_ - The name of an implementation of 34 | // OsStackTraceGetterInterface. 35 | // 36 | // ** Custom implementation starts here ** 37 | 38 | #ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_ 39 | #define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_ 40 | 41 | #endif // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_ 42 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/msvc/gtest-md.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 8.00 2 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest-md", "gtest-md.vcproj", "{C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}" 3 | ProjectSection(ProjectDependencies) = postProject 4 | EndProjectSection 5 | EndProject 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest_main-md", "gtest_main-md.vcproj", "{3AF54C8A-10BF-4332-9147-F68ED9862033}" 7 | ProjectSection(ProjectDependencies) = postProject 8 | EndProjectSection 9 | EndProject 10 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest_prod_test-md", "gtest_prod_test-md.vcproj", "{24848551-EF4F-47E8-9A9D-EA4D49BC3ECB}" 11 | ProjectSection(ProjectDependencies) = postProject 12 | EndProjectSection 13 | EndProject 14 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest_unittest-md", "gtest_unittest-md.vcproj", "{4D9FDFB5-986A-4139-823C-F4EE0ED481A2}" 15 | ProjectSection(ProjectDependencies) = postProject 16 | EndProjectSection 17 | EndProject 18 | Global 19 | GlobalSection(SolutionConfiguration) = preSolution 20 | Debug = Debug 21 | Release = Release 22 | EndGlobalSection 23 | GlobalSection(ProjectConfiguration) = postSolution 24 | {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}.Debug.ActiveCfg = Debug|Win32 25 | {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}.Debug.Build.0 = Debug|Win32 26 | {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}.Release.ActiveCfg = Release|Win32 27 | {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}.Release.Build.0 = Release|Win32 28 | {3AF54C8A-10BF-4332-9147-F68ED9862033}.Debug.ActiveCfg = Debug|Win32 29 | {3AF54C8A-10BF-4332-9147-F68ED9862033}.Debug.Build.0 = Debug|Win32 30 | {3AF54C8A-10BF-4332-9147-F68ED9862033}.Release.ActiveCfg = Release|Win32 31 | {3AF54C8A-10BF-4332-9147-F68ED9862033}.Release.Build.0 = Release|Win32 32 | {24848551-EF4F-47E8-9A9D-EA4D49BC3ECB}.Debug.ActiveCfg = Debug|Win32 33 | {24848551-EF4F-47E8-9A9D-EA4D49BC3ECB}.Debug.Build.0 = Debug|Win32 34 | {24848551-EF4F-47E8-9A9D-EA4D49BC3ECB}.Release.ActiveCfg = Release|Win32 35 | {24848551-EF4F-47E8-9A9D-EA4D49BC3ECB}.Release.Build.0 = Release|Win32 36 | {4D9FDFB5-986A-4139-823C-F4EE0ED481A2}.Debug.ActiveCfg = Debug|Win32 37 | {4D9FDFB5-986A-4139-823C-F4EE0ED481A2}.Debug.Build.0 = Debug|Win32 38 | {4D9FDFB5-986A-4139-823C-F4EE0ED481A2}.Release.ActiveCfg = Release|Win32 39 | {4D9FDFB5-986A-4139-823C-F4EE0ED481A2}.Release.Build.0 = Release|Win32 40 | EndGlobalSection 41 | GlobalSection(ExtensibilityGlobals) = postSolution 42 | EndGlobalSection 43 | GlobalSection(ExtensibilityAddIns) = postSolution 44 | EndGlobalSection 45 | EndGlobal 46 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/msvc/gtest.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 8.00 2 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest", "gtest.vcproj", "{C8F6C172-56F2-4E76-B5FA-C3B423B31BE7}" 3 | ProjectSection(ProjectDependencies) = postProject 4 | EndProjectSection 5 | EndProject 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest_main", "gtest_main.vcproj", "{3AF54C8A-10BF-4332-9147-F68ED9862032}" 7 | ProjectSection(ProjectDependencies) = postProject 8 | EndProjectSection 9 | EndProject 10 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest_unittest", "gtest_unittest.vcproj", "{4D9FDFB5-986A-4139-823C-F4EE0ED481A1}" 11 | ProjectSection(ProjectDependencies) = postProject 12 | EndProjectSection 13 | EndProject 14 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest_prod_test", "gtest_prod_test.vcproj", "{24848551-EF4F-47E8-9A9D-EA4D49BC3ECA}" 15 | ProjectSection(ProjectDependencies) = postProject 16 | EndProjectSection 17 | EndProject 18 | Global 19 | GlobalSection(SolutionConfiguration) = preSolution 20 | Debug = Debug 21 | Release = Release 22 | EndGlobalSection 23 | GlobalSection(ProjectConfiguration) = postSolution 24 | {C8F6C172-56F2-4E76-B5FA-C3B423B31BE7}.Debug.ActiveCfg = Debug|Win32 25 | {C8F6C172-56F2-4E76-B5FA-C3B423B31BE7}.Debug.Build.0 = Debug|Win32 26 | {C8F6C172-56F2-4E76-B5FA-C3B423B31BE7}.Release.ActiveCfg = Release|Win32 27 | {C8F6C172-56F2-4E76-B5FA-C3B423B31BE7}.Release.Build.0 = Release|Win32 28 | {3AF54C8A-10BF-4332-9147-F68ED9862032}.Debug.ActiveCfg = Debug|Win32 29 | {3AF54C8A-10BF-4332-9147-F68ED9862032}.Debug.Build.0 = Debug|Win32 30 | {3AF54C8A-10BF-4332-9147-F68ED9862032}.Release.ActiveCfg = Release|Win32 31 | {3AF54C8A-10BF-4332-9147-F68ED9862032}.Release.Build.0 = Release|Win32 32 | {4D9FDFB5-986A-4139-823C-F4EE0ED481A1}.Debug.ActiveCfg = Debug|Win32 33 | {4D9FDFB5-986A-4139-823C-F4EE0ED481A1}.Debug.Build.0 = Debug|Win32 34 | {4D9FDFB5-986A-4139-823C-F4EE0ED481A1}.Release.ActiveCfg = Release|Win32 35 | {4D9FDFB5-986A-4139-823C-F4EE0ED481A1}.Release.Build.0 = Release|Win32 36 | {24848551-EF4F-47E8-9A9D-EA4D49BC3ECA}.Debug.ActiveCfg = Debug|Win32 37 | {24848551-EF4F-47E8-9A9D-EA4D49BC3ECA}.Debug.Build.0 = Debug|Win32 38 | {24848551-EF4F-47E8-9A9D-EA4D49BC3ECA}.Release.ActiveCfg = Release|Win32 39 | {24848551-EF4F-47E8-9A9D-EA4D49BC3ECA}.Release.Build.0 = Release|Win32 40 | EndGlobalSection 41 | GlobalSection(ExtensibilityGlobals) = postSolution 42 | EndGlobalSection 43 | GlobalSection(ExtensibilityAddIns) = postSolution 44 | EndGlobalSection 45 | EndGlobal 46 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/samples/sample1.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // A sample program demonstrating using Google C++ testing framework. 31 | // 32 | // Author: wan@google.com (Zhanyong Wan) 33 | 34 | #include "sample1.h" 35 | 36 | // Returns n! (the factorial of n). For negative n, n! is defined to be 1. 37 | int Factorial(int n) { 38 | int result = 1; 39 | for (int i = 1; i <= n; i++) { 40 | result *= i; 41 | } 42 | 43 | return result; 44 | } 45 | 46 | // Returns true iff n is a prime number. 47 | bool IsPrime(int n) { 48 | // Trivial case 1: small numbers 49 | if (n <= 1) return false; 50 | 51 | // Trivial case 2: even numbers 52 | if (n % 2 == 0) return n == 2; 53 | 54 | // Now, we have that n is odd and n >= 3. 55 | 56 | // Try to divide n by every odd number i, starting from 3 57 | for (int i = 3; ; i += 2) { 58 | // We only have to try i up to the squre root of n 59 | if (i > n/i) break; 60 | 61 | // Now, we have i <= n/i < n. 62 | // If n is divisible by i, n is not prime. 63 | if (n % i == 0) return false; 64 | } 65 | 66 | // n has no integer factor in the range (1, n), and thus is prime. 67 | return true; 68 | } 69 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/samples/sample1.h: -------------------------------------------------------------------------------- 1 | // Copyright 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // A sample program demonstrating using Google C++ testing framework. 31 | // 32 | // Author: wan@google.com (Zhanyong Wan) 33 | 34 | #ifndef GTEST_SAMPLES_SAMPLE1_H_ 35 | #define GTEST_SAMPLES_SAMPLE1_H_ 36 | 37 | // Returns n! (the factorial of n). For negative n, n! is defined to be 1. 38 | int Factorial(int n); 39 | 40 | // Returns true iff n is a prime number. 41 | bool IsPrime(int n); 42 | 43 | #endif // GTEST_SAMPLES_SAMPLE1_H_ 44 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/samples/sample2.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // A sample program demonstrating using Google C++ testing framework. 31 | // 32 | // Author: wan@google.com (Zhanyong Wan) 33 | 34 | #include "sample2.h" 35 | 36 | #include 37 | 38 | // Clones a 0-terminated C string, allocating memory using new. 39 | const char* MyString::CloneCString(const char* a_c_string) { 40 | if (a_c_string == NULL) return NULL; 41 | 42 | const size_t len = strlen(a_c_string); 43 | char* const clone = new char[ len + 1 ]; 44 | memcpy(clone, a_c_string, len + 1); 45 | 46 | return clone; 47 | } 48 | 49 | // Sets the 0-terminated C string this MyString object 50 | // represents. 51 | void MyString::Set(const char* a_c_string) { 52 | // Makes sure this works when c_string == c_string_ 53 | const char* const temp = MyString::CloneCString(a_c_string); 54 | delete[] c_string_; 55 | c_string_ = temp; 56 | } 57 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/samples/sample4.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // A sample program demonstrating using Google C++ testing framework. 31 | // 32 | // Author: wan@google.com (Zhanyong Wan) 33 | 34 | #include 35 | 36 | #include "sample4.h" 37 | 38 | // Returns the current counter value, and increments it. 39 | int Counter::Increment() { 40 | return counter_++; 41 | } 42 | 43 | // Prints the current counter value to STDOUT. 44 | void Counter::Print() const { 45 | printf("%d", counter_); 46 | } 47 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/samples/sample4.h: -------------------------------------------------------------------------------- 1 | // Copyright 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // A sample program demonstrating using Google C++ testing framework. 31 | // 32 | // Author: wan@google.com (Zhanyong Wan) 33 | 34 | #ifndef GTEST_SAMPLES_SAMPLE4_H_ 35 | #define GTEST_SAMPLES_SAMPLE4_H_ 36 | 37 | // A simple monotonic counter. 38 | class Counter { 39 | private: 40 | int counter_; 41 | 42 | public: 43 | // Creates a counter that starts at 0. 44 | Counter() : counter_(0) {} 45 | 46 | // Returns the current counter value, and increments it. 47 | int Increment(); 48 | 49 | // Prints the current counter value to STDOUT. 50 | void Print() const; 51 | }; 52 | 53 | #endif // GTEST_SAMPLES_SAMPLE4_H_ 54 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/samples/sample4_unittest.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | 32 | #include "gtest/gtest.h" 33 | #include "sample4.h" 34 | 35 | // Tests the Increment() method. 36 | TEST(Counter, Increment) { 37 | Counter c; 38 | 39 | // EXPECT_EQ() evaluates its arguments exactly once, so they 40 | // can have side effects. 41 | 42 | EXPECT_EQ(0, c.Increment()); 43 | EXPECT_EQ(1, c.Increment()); 44 | EXPECT_EQ(2, c.Increment()); 45 | } 46 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/scripts/test/Makefile: -------------------------------------------------------------------------------- 1 | # A Makefile for fusing Google Test and building a sample test against it. 2 | # 3 | # SYNOPSIS: 4 | # 5 | # make [all] - makes everything. 6 | # make TARGET - makes the given target. 7 | # make check - makes everything and runs the built sample test. 8 | # make clean - removes all files generated by make. 9 | 10 | # Points to the root of fused Google Test, relative to where this file is. 11 | FUSED_GTEST_DIR = output 12 | 13 | # Paths to the fused gtest files. 14 | FUSED_GTEST_H = $(FUSED_GTEST_DIR)/gtest/gtest.h 15 | FUSED_GTEST_ALL_CC = $(FUSED_GTEST_DIR)/gtest/gtest-all.cc 16 | 17 | # Where to find the sample test. 18 | SAMPLE_DIR = ../../samples 19 | 20 | # Where to find gtest_main.cc. 21 | GTEST_MAIN_CC = ../../src/gtest_main.cc 22 | 23 | # Flags passed to the preprocessor. 24 | # We have no idea here whether pthreads is available in the system, so 25 | # disable its use. 26 | CPPFLAGS += -I$(FUSED_GTEST_DIR) -DGTEST_HAS_PTHREAD=0 27 | 28 | # Flags passed to the C++ compiler. 29 | CXXFLAGS += -g 30 | 31 | all : sample1_unittest 32 | 33 | check : all 34 | ./sample1_unittest 35 | 36 | clean : 37 | rm -rf $(FUSED_GTEST_DIR) sample1_unittest *.o 38 | 39 | $(FUSED_GTEST_H) : 40 | ../fuse_gtest_files.py $(FUSED_GTEST_DIR) 41 | 42 | $(FUSED_GTEST_ALL_CC) : 43 | ../fuse_gtest_files.py $(FUSED_GTEST_DIR) 44 | 45 | gtest-all.o : $(FUSED_GTEST_H) $(FUSED_GTEST_ALL_CC) 46 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(FUSED_GTEST_DIR)/gtest/gtest-all.cc 47 | 48 | gtest_main.o : $(FUSED_GTEST_H) $(GTEST_MAIN_CC) 49 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(GTEST_MAIN_CC) 50 | 51 | sample1.o : $(SAMPLE_DIR)/sample1.cc $(SAMPLE_DIR)/sample1.h 52 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(SAMPLE_DIR)/sample1.cc 53 | 54 | sample1_unittest.o : $(SAMPLE_DIR)/sample1_unittest.cc \ 55 | $(SAMPLE_DIR)/sample1.h $(FUSED_GTEST_H) 56 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(SAMPLE_DIR)/sample1_unittest.cc 57 | 58 | sample1_unittest : sample1.o sample1_unittest.o gtest-all.o gtest_main.o 59 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) $^ -o $@ 60 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/src/gtest-all.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: mheule@google.com (Markus Heule) 31 | // 32 | // Google C++ Testing Framework (Google Test) 33 | // 34 | // Sometimes it's desirable to build Google Test by compiling a single file. 35 | // This file serves this purpose. 36 | 37 | // This line ensures that gtest.h can be compiled on its own, even 38 | // when it's fused. 39 | #include "gtest/gtest.h" 40 | 41 | // The following lines pull in the real gtest *.cc files. 42 | #include "src/gtest.cc" 43 | #include "src/gtest-death-test.cc" 44 | #include "src/gtest-filepath.cc" 45 | #include "src/gtest-port.cc" 46 | #include "src/gtest-printers.cc" 47 | #include "src/gtest-test-part.cc" 48 | #include "src/gtest-typed-test.cc" 49 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/src/gtest_main.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | #include 31 | 32 | #include "gtest/gtest.h" 33 | 34 | GTEST_API_ int main(int argc, char **argv) { 35 | printf("Running main() from gtest_main.cc\n"); 36 | testing::InitGoogleTest(&argc, argv); 37 | return RUN_ALL_TESTS(); 38 | } 39 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/test/gtest-param-test_test.h: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Authors: vladl@google.com (Vlad Losev) 31 | // 32 | // The Google C++ Testing Framework (Google Test) 33 | // 34 | // This header file provides classes and functions used internally 35 | // for testing Google Test itself. 36 | 37 | #ifndef GTEST_TEST_GTEST_PARAM_TEST_TEST_H_ 38 | #define GTEST_TEST_GTEST_PARAM_TEST_TEST_H_ 39 | 40 | #include "gtest/gtest.h" 41 | 42 | #if GTEST_HAS_PARAM_TEST 43 | 44 | // Test fixture for testing definition and instantiation of a test 45 | // in separate translation units. 46 | class ExternalInstantiationTest : public ::testing::TestWithParam { 47 | }; 48 | 49 | // Test fixture for testing instantiation of a test in multiple 50 | // translation units. 51 | class InstantiationInMultipleTranslaionUnitsTest 52 | : public ::testing::TestWithParam { 53 | }; 54 | 55 | #endif // GTEST_HAS_PARAM_TEST 56 | 57 | #endif // GTEST_TEST_GTEST_PARAM_TEST_TEST_H_ 58 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/test/gtest-typed-test2_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008 Google Inc. 2 | // All Rights Reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | 32 | #include 33 | 34 | #include "test/gtest-typed-test_test.h" 35 | #include "gtest/gtest.h" 36 | 37 | #if GTEST_HAS_TYPED_TEST_P 38 | 39 | // Tests that the same type-parameterized test case can be 40 | // instantiated in different translation units linked together. 41 | // (ContainerTest is also instantiated in gtest-typed-test_test.cc.) 42 | INSTANTIATE_TYPED_TEST_CASE_P(Vector, ContainerTest, 43 | testing::Types >); 44 | 45 | #endif // GTEST_HAS_TYPED_TEST_P 46 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/test/gtest-typed-test_test.h: -------------------------------------------------------------------------------- 1 | // Copyright 2008 Google Inc. 2 | // All Rights Reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | 32 | #ifndef GTEST_TEST_GTEST_TYPED_TEST_TEST_H_ 33 | #define GTEST_TEST_GTEST_TYPED_TEST_TEST_H_ 34 | 35 | #include "gtest/gtest.h" 36 | 37 | #if GTEST_HAS_TYPED_TEST_P 38 | 39 | using testing::Test; 40 | 41 | // For testing that the same type-parameterized test case can be 42 | // instantiated in different translation units linked together. 43 | // ContainerTest will be instantiated in both gtest-typed-test_test.cc 44 | // and gtest-typed-test2_test.cc. 45 | 46 | template 47 | class ContainerTest : public Test { 48 | }; 49 | 50 | TYPED_TEST_CASE_P(ContainerTest); 51 | 52 | TYPED_TEST_P(ContainerTest, CanBeDefaultConstructed) { 53 | TypeParam container; 54 | } 55 | 56 | TYPED_TEST_P(ContainerTest, InitialSizeIsZero) { 57 | TypeParam container; 58 | EXPECT_EQ(0U, container.size()); 59 | } 60 | 61 | REGISTER_TYPED_TEST_CASE_P(ContainerTest, 62 | CanBeDefaultConstructed, InitialSizeIsZero); 63 | 64 | #endif // GTEST_HAS_TYPED_TEST_P 65 | 66 | #endif // GTEST_TEST_GTEST_TYPED_TEST_TEST_H_ 67 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/test/gtest_all_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2009, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | // 32 | // Tests for Google C++ Testing Framework (Google Test) 33 | // 34 | // Sometimes it's desirable to build most of Google Test's own tests 35 | // by compiling a single file. This file serves this purpose. 36 | #include "test/gtest-filepath_test.cc" 37 | #include "test/gtest-linked_ptr_test.cc" 38 | #include "test/gtest-message_test.cc" 39 | #include "test/gtest-options_test.cc" 40 | #include "test/gtest-port_test.cc" 41 | #include "test/gtest_pred_impl_unittest.cc" 42 | #include "test/gtest_prod_test.cc" 43 | #include "test/gtest-test-part_test.cc" 44 | #include "test/gtest-typed-test_test.cc" 45 | #include "test/gtest-typed-test2_test.cc" 46 | #include "test/gtest_unittest.cc" 47 | #include "test/production.cc" 48 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/test/gtest_help_test_.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2009, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | 32 | // This program is meant to be run by gtest_help_test.py. Do not run 33 | // it directly. 34 | 35 | #include "gtest/gtest.h" 36 | 37 | // When a help flag is specified, this program should skip the tests 38 | // and exit with 0; otherwise the following test will be executed, 39 | // causing this program to exit with a non-zero code. 40 | TEST(HelpFlagTest, ShouldNotBeRun) { 41 | ASSERT_TRUE(false) << "Tests shouldn't be run when --help is specified."; 42 | } 43 | 44 | #if GTEST_HAS_DEATH_TEST 45 | TEST(DeathTest, UsedByPythonScriptToDetectSupportForDeathTestsInThisBinary) {} 46 | #endif 47 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/test/gtest_main_unittest.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | 32 | #include "gtest/gtest.h" 33 | 34 | // Tests that we don't have to define main() when we link to 35 | // gtest_main instead of gtest. 36 | 37 | namespace { 38 | 39 | TEST(GTestMainTest, ShouldSucceed) { 40 | } 41 | 42 | } // namespace 43 | 44 | // We are using the main() function defined in src/gtest_main.cc, so 45 | // we don't define it here. 46 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/test/gtest_no_test_unittest.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // Tests that a Google Test program that has no test defined can run 31 | // successfully. 32 | // 33 | // Author: wan@google.com (Zhanyong Wan) 34 | 35 | #include "gtest/gtest.h" 36 | 37 | int main(int argc, char **argv) { 38 | testing::InitGoogleTest(&argc, argv); 39 | 40 | // An ad-hoc assertion outside of all tests. 41 | // 42 | // This serves three purposes: 43 | // 44 | // 1. It verifies that an ad-hoc assertion can be executed even if 45 | // no test is defined. 46 | // 2. It verifies that a failed ad-hoc assertion causes the test 47 | // program to fail. 48 | // 3. We had a bug where the XML output won't be generated if an 49 | // assertion is executed before RUN_ALL_TESTS() is called, even 50 | // though --gtest_output=xml is specified. This makes sure the 51 | // bug is fixed and doesn't regress. 52 | EXPECT_EQ(1, 2); 53 | 54 | // The above EXPECT_EQ() should cause RUN_ALL_TESTS() to return non-zero. 55 | return RUN_ALL_TESTS() ? 0 : 1; 56 | } 57 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/test/gtest_prod_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | // 32 | // Unit test for include/gtest/gtest_prod.h. 33 | 34 | #include "gtest/gtest.h" 35 | #include "test/production.h" 36 | 37 | // Tests that private members can be accessed from a TEST declared as 38 | // a friend of the class. 39 | TEST(PrivateCodeTest, CanAccessPrivateMembers) { 40 | PrivateCode a; 41 | EXPECT_EQ(0, a.x_); 42 | 43 | a.set_x(1); 44 | EXPECT_EQ(1, a.x_); 45 | } 46 | 47 | typedef testing::Test PrivateCodeFixtureTest; 48 | 49 | // Tests that private members can be accessed from a TEST_F declared 50 | // as a friend of the class. 51 | TEST_F(PrivateCodeFixtureTest, CanAccessPrivateMembers) { 52 | PrivateCode a; 53 | EXPECT_EQ(0, a.x_); 54 | 55 | a.set_x(2); 56 | EXPECT_EQ(2, a.x_); 57 | } 58 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/test/gtest_sole_header_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: mheule@google.com (Markus Heule) 31 | // 32 | // This test verifies that it's possible to use Google Test by including 33 | // the gtest.h header file alone. 34 | 35 | #include "gtest/gtest.h" 36 | 37 | namespace { 38 | 39 | void Subroutine() { 40 | EXPECT_EQ(42, 42); 41 | } 42 | 43 | TEST(NoFatalFailureTest, ExpectNoFatalFailure) { 44 | EXPECT_NO_FATAL_FAILURE(;); 45 | EXPECT_NO_FATAL_FAILURE(SUCCEED()); 46 | EXPECT_NO_FATAL_FAILURE(Subroutine()); 47 | EXPECT_NO_FATAL_FAILURE({ SUCCEED(); }); 48 | } 49 | 50 | TEST(NoFatalFailureTest, AssertNoFatalFailure) { 51 | ASSERT_NO_FATAL_FAILURE(;); 52 | ASSERT_NO_FATAL_FAILURE(SUCCEED()); 53 | ASSERT_NO_FATAL_FAILURE(Subroutine()); 54 | ASSERT_NO_FATAL_FAILURE({ SUCCEED(); }); 55 | } 56 | 57 | } // namespace 58 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/test/gtest_uninitialized_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Copyright 2008, Google Inc. 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of Google Inc. nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | """Verifies that Google Test warns the user when not initialized properly.""" 33 | 34 | __author__ = 'wan@google.com (Zhanyong Wan)' 35 | 36 | import gtest_test_utils 37 | 38 | 39 | COMMAND = gtest_test_utils.GetTestExecutablePath('gtest_uninitialized_test_') 40 | 41 | 42 | def Assert(condition): 43 | if not condition: 44 | raise AssertionError 45 | 46 | 47 | def AssertEq(expected, actual): 48 | if expected != actual: 49 | print 'Expected: %s' % (expected,) 50 | print ' Actual: %s' % (actual,) 51 | raise AssertionError 52 | 53 | 54 | def TestExitCodeAndOutput(command): 55 | """Runs the given command and verifies its exit code and output.""" 56 | 57 | # Verifies that 'command' exits with code 1. 58 | p = gtest_test_utils.Subprocess(command) 59 | Assert(p.exited) 60 | AssertEq(1, p.exit_code) 61 | Assert('InitGoogleTest' in p.output) 62 | 63 | 64 | class GTestUninitializedTest(gtest_test_utils.TestCase): 65 | def testExitCodeAndOutput(self): 66 | TestExitCodeAndOutput(COMMAND) 67 | 68 | 69 | if __name__ == '__main__': 70 | gtest_test_utils.Main() 71 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/test/gtest_uninitialized_test_.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | 32 | #include "gtest/gtest.h" 33 | 34 | TEST(DummyTest, Dummy) { 35 | // This test doesn't verify anything. We just need it to create a 36 | // realistic stage for testing the behavior of Google Test when 37 | // RUN_ALL_TESTS() is called without testing::InitGoogleTest() being 38 | // called first. 39 | } 40 | 41 | int main() { 42 | return RUN_ALL_TESTS(); 43 | } 44 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/test/gtest_xml_outfile1_test_.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: keith.ray@gmail.com (Keith Ray) 31 | // 32 | // gtest_xml_outfile1_test_ writes some xml via TestProperty used by 33 | // gtest_xml_outfiles_test.py 34 | 35 | #include "gtest/gtest.h" 36 | 37 | class PropertyOne : public testing::Test { 38 | protected: 39 | virtual void SetUp() { 40 | RecordProperty("SetUpProp", 1); 41 | } 42 | virtual void TearDown() { 43 | RecordProperty("TearDownProp", 1); 44 | } 45 | }; 46 | 47 | TEST_F(PropertyOne, TestSomeProperties) { 48 | RecordProperty("TestSomeProperty", 1); 49 | } 50 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/test/gtest_xml_outfile2_test_.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: keith.ray@gmail.com (Keith Ray) 31 | // 32 | // gtest_xml_outfile2_test_ writes some xml via TestProperty used by 33 | // gtest_xml_outfiles_test.py 34 | 35 | #include "gtest/gtest.h" 36 | 37 | class PropertyTwo : public testing::Test { 38 | protected: 39 | virtual void SetUp() { 40 | RecordProperty("SetUpProp", 2); 41 | } 42 | virtual void TearDown() { 43 | RecordProperty("TearDownProp", 2); 44 | } 45 | }; 46 | 47 | TEST_F(PropertyTwo, TestSomeProperties) { 48 | RecordProperty("TestSomeProperty", 2); 49 | } 50 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/test/production.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | // 32 | // This is part of the unit test for include/gtest/gtest_prod.h. 33 | 34 | #include "production.h" 35 | 36 | PrivateCode::PrivateCode() : x_(0) {} 37 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/test/production.h: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | // 32 | // This is part of the unit test for include/gtest/gtest_prod.h. 33 | 34 | #ifndef GTEST_TEST_PRODUCTION_H_ 35 | #define GTEST_TEST_PRODUCTION_H_ 36 | 37 | #include "gtest/gtest_prod.h" 38 | 39 | class PrivateCode { 40 | public: 41 | // Declares a friend test that does not use a fixture. 42 | FRIEND_TEST(PrivateCodeTest, CanAccessPrivateMembers); 43 | 44 | // Declares a friend test that uses a fixture. 45 | FRIEND_TEST(PrivateCodeFixtureTest, CanAccessPrivateMembers); 46 | 47 | PrivateCode(); 48 | 49 | int x() const { return x_; } 50 | private: 51 | void set_x(int an_x) { x_ = an_x; } 52 | int x_; 53 | }; 54 | 55 | #endif // GTEST_TEST_PRODUCTION_H_ 56 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/xcode/Config/DebugProject.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // DebugProject.xcconfig 3 | // 4 | // These are Debug Configuration project settings for the gtest framework and 5 | // examples. It is set in the "Based On:" dropdown in the "Project" info 6 | // dialog. 7 | // This file is based on the Xcode Configuration files in: 8 | // http://code.google.com/p/google-toolbox-for-mac/ 9 | // 10 | 11 | #include "General.xcconfig" 12 | 13 | // No optimization 14 | GCC_OPTIMIZATION_LEVEL = 0 15 | 16 | // Deployment postprocessing is what triggers Xcode to strip, turn it off 17 | DEPLOYMENT_POSTPROCESSING = NO 18 | 19 | // Dead code stripping off 20 | DEAD_CODE_STRIPPING = NO 21 | 22 | // Debug symbols should be on obviously 23 | GCC_GENERATE_DEBUGGING_SYMBOLS = YES 24 | 25 | // Define the DEBUG macro in all debug builds 26 | OTHER_CFLAGS = $(OTHER_CFLAGS) -DDEBUG=1 27 | 28 | // These are turned off to avoid STL incompatibilities with client code 29 | // // Turns on special C++ STL checks to "encourage" good STL use 30 | // GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) _GLIBCXX_DEBUG_PEDANTIC _GLIBCXX_DEBUG _GLIBCPP_CONCEPT_CHECKS 31 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/xcode/Config/FrameworkTarget.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // FrameworkTarget.xcconfig 3 | // 4 | // These are Framework target settings for the gtest framework and examples. It 5 | // is set in the "Based On:" dropdown in the "Target" info dialog. 6 | // This file is based on the Xcode Configuration files in: 7 | // http://code.google.com/p/google-toolbox-for-mac/ 8 | // 9 | 10 | // Dynamic libs need to be position independent 11 | GCC_DYNAMIC_NO_PIC = NO 12 | 13 | // Dynamic libs should not have their external symbols stripped. 14 | STRIP_STYLE = non-global 15 | 16 | // Let the user install by specifying the $DSTROOT with xcodebuild 17 | SKIP_INSTALL = NO 18 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/xcode/Config/General.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // General.xcconfig 3 | // 4 | // These are General configuration settings for the gtest framework and 5 | // examples. 6 | // This file is based on the Xcode Configuration files in: 7 | // http://code.google.com/p/google-toolbox-for-mac/ 8 | // 9 | 10 | // Build for PPC and Intel, 32- and 64-bit 11 | ARCHS = i386 x86_64 ppc ppc64 12 | 13 | // Zerolink prevents link warnings so turn it off 14 | ZERO_LINK = NO 15 | 16 | // Prebinding considered unhelpful in 10.3 and later 17 | PREBINDING = NO 18 | 19 | // Strictest warning policy 20 | WARNING_CFLAGS = -Wall -Werror -Wendif-labels -Wnewline-eof -Wno-sign-compare -Wshadow 21 | 22 | // Work around Xcode bugs by using external strip. See: 23 | // http://lists.apple.com/archives/Xcode-users/2006/Feb/msg00050.html 24 | SEPARATE_STRIP = YES 25 | 26 | // Force C99 dialect 27 | GCC_C_LANGUAGE_STANDARD = c99 28 | 29 | // not sure why apple defaults this on, but it's pretty risky 30 | ALWAYS_SEARCH_USER_PATHS = NO 31 | 32 | // Turn on position dependent code for most cases (overridden where appropriate) 33 | GCC_DYNAMIC_NO_PIC = YES 34 | 35 | // Default SDK and minimum OS version is 10.4 36 | SDKROOT = $(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk 37 | MACOSX_DEPLOYMENT_TARGET = 10.4 38 | GCC_VERSION = 4.0 39 | 40 | // VERSIONING BUILD SETTINGS (used in Info.plist) 41 | GTEST_VERSIONINFO_ABOUT = © 2008 Google Inc. 42 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/xcode/Config/ReleaseProject.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // ReleaseProject.xcconfig 3 | // 4 | // These are Release Configuration project settings for the gtest framework 5 | // and examples. It is set in the "Based On:" dropdown in the "Project" info 6 | // dialog. 7 | // This file is based on the Xcode Configuration files in: 8 | // http://code.google.com/p/google-toolbox-for-mac/ 9 | // 10 | 11 | #include "General.xcconfig" 12 | 13 | // subconfig/Release.xcconfig 14 | 15 | // Optimize for space and size (Apple recommendation) 16 | GCC_OPTIMIZATION_LEVEL = s 17 | 18 | // Deploment postprocessing is what triggers Xcode to strip 19 | DEPLOYMENT_POSTPROCESSING = YES 20 | 21 | // No symbols 22 | GCC_GENERATE_DEBUGGING_SYMBOLS = NO 23 | 24 | // Dead code strip does not affect ObjC code but can help for C 25 | DEAD_CODE_STRIPPING = YES 26 | 27 | // NDEBUG is used by things like assert.h, so define it for general compat. 28 | // ASSERT going away in release tends to create unused vars. 29 | OTHER_CFLAGS = $(OTHER_CFLAGS) -DNDEBUG=1 -Wno-unused-variable 30 | 31 | // When we strip we want to strip all symbols in release, but save externals. 32 | STRIP_STYLE = all 33 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/xcode/Config/StaticLibraryTarget.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // StaticLibraryTarget.xcconfig 3 | // 4 | // These are static library target settings for libgtest.a. It 5 | // is set in the "Based On:" dropdown in the "Target" info dialog. 6 | // This file is based on the Xcode Configuration files in: 7 | // http://code.google.com/p/google-toolbox-for-mac/ 8 | // 9 | 10 | // Static libs can be included in bundles so make them position independent 11 | GCC_DYNAMIC_NO_PIC = NO 12 | 13 | // Static libs should not have their internal globals or external symbols 14 | // stripped. 15 | STRIP_STYLE = debugging 16 | 17 | // Let the user install by specifying the $DSTROOT with xcodebuild 18 | SKIP_INSTALL = NO 19 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/xcode/Config/TestTarget.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // TestTarget.xcconfig 3 | // 4 | // These are Test target settings for the gtest framework and examples. It 5 | // is set in the "Based On:" dropdown in the "Target" info dialog. 6 | 7 | PRODUCT_NAME = $(TARGET_NAME) 8 | HEADER_SEARCH_PATHS = ../include 9 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/xcode/Resources/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.google.${PRODUCT_NAME} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | GTEST_VERSIONINFO_LONG 21 | CFBundleShortVersionString 22 | GTEST_VERSIONINFO_SHORT 23 | CFBundleGetInfoString 24 | ${PRODUCT_NAME} GTEST_VERSIONINFO_LONG, ${GTEST_VERSIONINFO_ABOUT} 25 | NSHumanReadableCopyright 26 | ${GTEST_VERSIONINFO_ABOUT} 27 | CSResourcesFileMapped 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/xcode/Samples/FrameworkSample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.google.gtest.${PRODUCT_NAME:identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | FMWK 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | CSResourcesFileMapped 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/xcode/Samples/FrameworkSample/runtests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright 2008, Google Inc. 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of Google Inc. nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | # Executes the samples and tests for the Google Test Framework. 33 | 34 | # Help the dynamic linker find the path to the libraries. 35 | export DYLD_FRAMEWORK_PATH=$BUILT_PRODUCTS_DIR 36 | export DYLD_LIBRARY_PATH=$BUILT_PRODUCTS_DIR 37 | 38 | # Create some executables. 39 | test_executables=$@ 40 | 41 | # Now execute each one in turn keeping track of how many succeeded and failed. 42 | succeeded=0 43 | failed=0 44 | failed_list=() 45 | for test in ${test_executables[*]}; do 46 | "$test" 47 | result=$? 48 | if [ $result -eq 0 ]; then 49 | succeeded=$(( $succeeded + 1 )) 50 | else 51 | failed=$(( failed + 1 )) 52 | failed_list="$failed_list $test" 53 | fi 54 | done 55 | 56 | # Report the successes and failures to the console. 57 | echo "Tests complete with $succeeded successes and $failed failures." 58 | if [ $failed -ne 0 ]; then 59 | echo "The following tests failed:" 60 | echo $failed_list 61 | fi 62 | exit $failed 63 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/xcode/Samples/FrameworkSample/widget.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: preston.a.jackson@gmail.com (Preston Jackson) 31 | // 32 | // Google Test - FrameworkSample 33 | // widget.cc 34 | // 35 | 36 | // Widget is a very simple class used for demonstrating the use of gtest 37 | 38 | #include "widget.h" 39 | 40 | Widget::Widget(int number, const std::string& name) 41 | : number_(number), 42 | name_(name) {} 43 | 44 | Widget::~Widget() {} 45 | 46 | float Widget::GetFloatValue() const { 47 | return number_; 48 | } 49 | 50 | int Widget::GetIntValue() const { 51 | return static_cast(number_); 52 | } 53 | 54 | std::string Widget::GetStringValue() const { 55 | return name_; 56 | } 57 | 58 | void Widget::GetCharPtrValue(char* buffer, size_t max_size) const { 59 | // Copy the char* representation of name_ into buffer, up to max_size. 60 | strncpy(buffer, name_.c_str(), max_size-1); 61 | buffer[max_size-1] = '\0'; 62 | return; 63 | } 64 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/xcode/Samples/FrameworkSample/widget.h: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: preston.a.jackson@gmail.com (Preston Jackson) 31 | // 32 | // Google Test - FrameworkSample 33 | // widget.h 34 | // 35 | 36 | // Widget is a very simple class used for demonstrating the use of gtest. It 37 | // simply stores two values a string and an integer, which are returned via 38 | // public accessors in multiple forms. 39 | 40 | #import 41 | 42 | class Widget { 43 | public: 44 | Widget(int number, const std::string& name); 45 | ~Widget(); 46 | 47 | // Public accessors to number data 48 | float GetFloatValue() const; 49 | int GetIntValue() const; 50 | 51 | // Public accessors to the string data 52 | std::string GetStringValue() const; 53 | void GetCharPtrValue(char* buffer, size_t max_size) const; 54 | 55 | private: 56 | // Data members 57 | float number_; 58 | std::string name_; 59 | }; 60 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/xcode/Samples/FrameworkSample/widget_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: preston.a.jackson@gmail.com (Preston Jackson) 31 | // 32 | // Google Test - FrameworkSample 33 | // widget_test.cc 34 | // 35 | 36 | // This is a simple test file for the Widget class in the Widget.framework 37 | 38 | #include 39 | #include "gtest/gtest.h" 40 | 41 | #include 42 | 43 | // This test verifies that the constructor sets the internal state of the 44 | // Widget class correctly. 45 | TEST(WidgetInitializerTest, TestConstructor) { 46 | Widget widget(1.0f, "name"); 47 | EXPECT_FLOAT_EQ(1.0f, widget.GetFloatValue()); 48 | EXPECT_EQ(std::string("name"), widget.GetStringValue()); 49 | } 50 | 51 | // This test verifies the conversion of the float and string values to int and 52 | // char*, respectively. 53 | TEST(WidgetInitializerTest, TestConversion) { 54 | Widget widget(1.0f, "name"); 55 | EXPECT_EQ(1, widget.GetIntValue()); 56 | 57 | size_t max_size = 128; 58 | char buffer[max_size]; 59 | widget.GetCharPtrValue(buffer, max_size); 60 | EXPECT_STREQ("name", buffer); 61 | } 62 | 63 | // Use the Google Test main that is linked into the framework. It does something 64 | // like this: 65 | // int main(int argc, char** argv) { 66 | // testing::InitGoogleTest(&argc, argv); 67 | // return RUN_ALL_TESTS(); 68 | // } 69 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/googletest/xcode/Scripts/runtests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright 2008, Google Inc. 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of Google Inc. nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | # Executes the samples and tests for the Google Test Framework. 33 | 34 | # Help the dynamic linker find the path to the libraries. 35 | export DYLD_FRAMEWORK_PATH=$BUILT_PRODUCTS_DIR 36 | export DYLD_LIBRARY_PATH=$BUILT_PRODUCTS_DIR 37 | 38 | # Create some executables. 39 | test_executables=("$BUILT_PRODUCTS_DIR/gtest_unittest-framework" 40 | "$BUILT_PRODUCTS_DIR/gtest_unittest" 41 | "$BUILT_PRODUCTS_DIR/sample1_unittest-framework" 42 | "$BUILT_PRODUCTS_DIR/sample1_unittest-static") 43 | 44 | # Now execute each one in turn keeping track of how many succeeded and failed. 45 | succeeded=0 46 | failed=0 47 | failed_list=() 48 | for test in ${test_executables[*]}; do 49 | "$test" 50 | result=$? 51 | if [ $result -eq 0 ]; then 52 | succeeded=$(( $succeeded + 1 )) 53 | else 54 | failed=$(( failed + 1 )) 55 | failed_list="$failed_list $test" 56 | fi 57 | done 58 | 59 | # Report the successes and failures to the console. 60 | echo "Tests complete with $succeeded successes and $failed failures." 61 | if [ $failed -ne 0 ]; then 62 | echo "The following tests failed:" 63 | echo $failed_list 64 | fi 65 | exit $failed 66 | -------------------------------------------------------------------------------- /tests/gtest/gtest/googletest/travis.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | set -evx 3 | env | sort 4 | 5 | mkdir build || true 6 | mkdir build/$GTEST_TARGET || true 7 | cd build/$GTEST_TARGET 8 | cmake -Dgtest_build_samples=ON \ 9 | -Dgmock_build_samples=ON \ 10 | -Dgtest_build_tests=ON \ 11 | -Dgmock_build_tests=ON \ 12 | -DCMAKE_CXX_FLAGS=$CXX_FLAGS \ 13 | ../../$GTEST_TARGET 14 | make 15 | make test 16 | -------------------------------------------------------------------------------- /tests/gtest/gtest/gtest.pro: -------------------------------------------------------------------------------- 1 | QT -= gui 2 | TARGET = gtest 3 | TEMPLATE = lib 4 | DEFINES += GTEST_LIBRARY 5 | 6 | SOURCES += googletest/googletest/src/gtest-all.cc 7 | SOURCES += googletest/googlemock/src/gmock-all.cc 8 | 9 | INCLUDEPATH += \ 10 | googletest/googletest/include \ 11 | googletest/googletest \ 12 | googletest/googlemock/include \ 13 | googletest/googlemock 14 | -------------------------------------------------------------------------------- /tests/gtest/gtest/gtest.qbs: -------------------------------------------------------------------------------- 1 | import qbs 2 | 3 | DynamicLibrary { 4 | name: "Google-Test" 5 | targetName: "gtest" 6 | 7 | cpp.defines: [ 8 | "GTEST_LIBRARY" 9 | ] 10 | 11 | files: [ 12 | "googletest/googletest/src/gtest-all.cc", 13 | "googletest/googlemock/src/gmock-all.cc", 14 | ] 15 | 16 | cpp.includePaths: [ 17 | "googletest/googletest/include", 18 | "googletest/googletest", 19 | "googletest/googlemock/include", 20 | "googletest/googlemock", 21 | ] 22 | 23 | Depends { 24 | name: "Qt" 25 | submodules: [ 26 | "core" 27 | ] 28 | } 29 | 30 | Export { 31 | Depends { 32 | name: "cpp" 33 | } 34 | 35 | cpp.includePaths: [ 36 | "googletest/googletest/include", 37 | "googletest/googlemock/include", 38 | ] 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /tests/gtest/tests/customprinter.h: -------------------------------------------------------------------------------- 1 | #ifndef CUSTOM_PRINTER_H 2 | #define CUSTOM_PRINTER_H 3 | 4 | #include 5 | #include 6 | 7 | class CustomPrinter : public testing::EmptyTestEventListener 8 | { 9 | public: 10 | CustomPrinter(); 11 | 12 | QTextStream qout; 13 | QTextStream qerr; 14 | 15 | void PrintTestName(const char* test_case, const char* test) 16 | { 17 | qout << test_case << "." << test; 18 | } 19 | 20 | virtual void OnTestProgramStart(const testing::UnitTest& /*unit_test*/) {} 21 | virtual void OnTestIterationStart(const testing::UnitTest& unit_test, int iteration); 22 | virtual void OnEnvironmentsSetUpStart(const testing::UnitTest& unit_test); 23 | virtual void OnEnvironmentsSetUpEnd(const testing::UnitTest& /*unit_test*/) {} 24 | virtual void OnTestCaseStart(const testing::TestCase& test_case); 25 | virtual void OnTestStart(const testing::TestInfo& test_info); 26 | //virtual void OnTestPartResult(const testing::TestPartResult& result); 27 | virtual void OnTestEnd(const testing::TestInfo& test_info); 28 | virtual void OnTestCaseEnd(const testing::TestCase& test_case); 29 | virtual void OnEnvironmentsTearDownStart(const testing::UnitTest& unit_test); 30 | virtual void OnEnvironmentsTearDownEnd(const testing::UnitTest& /*unit_test*/) {} 31 | virtual void OnTestIterationEnd(const testing::UnitTest& unit_test, int iteration); 32 | virtual void OnTestProgramEnd(const testing::UnitTest& /*unit_test*/) {} 33 | 34 | private: 35 | static void PrintFailedTests(const testing::UnitTest& unit_test); 36 | }; 37 | 38 | #endif // CUSTOM_PRINTER_H 39 | -------------------------------------------------------------------------------- /tests/gtest/tests/iodevicemock.h: -------------------------------------------------------------------------------- 1 | #ifndef IODEVICEMOCK_H 2 | #define IODEVICEMOCK_H 3 | 4 | #include 5 | #include 6 | 7 | class IODeviceMock : public QIODevice 8 | { 9 | public: 10 | MOCK_CONST_METHOD0(atEnd, bool()); 11 | MOCK_METHOD1(waitForBytesWritten, bool(int)); 12 | 13 | MOCK_METHOD2(readData, qint64(char*, qint64)); 14 | MOCK_METHOD2(writeData, qint64(const char *, qint64)); 15 | MOCK_CONST_METHOD0(openMode, QIODevice::OpenMode()); 16 | MOCK_CONST_METHOD0(bytesAvailable, qint64()); 17 | 18 | MOCK_METHOD2(write, qint64(const char*, qint64)); 19 | MOCK_METHOD1(write, qint64(const char*)); 20 | MOCK_METHOD1(write, qint64(const QByteArray&)); 21 | }; 22 | 23 | #endif // IODEVICEMOCK_H 24 | -------------------------------------------------------------------------------- /tests/gtest/tests/main.cpp: -------------------------------------------------------------------------------- 1 | #include "customprinter.h" 2 | #include 3 | #include 4 | #include 5 | 6 | void installCustomTestPrinter(testing::TestEventListener* listener) 7 | { 8 | testing::TestEventListeners& listeners = 9 | testing::UnitTest::GetInstance()->listeners(); 10 | delete listeners.Release(listeners.default_result_printer()); 11 | listeners.Append(listener); 12 | } 13 | 14 | int main(int argc, char **argv) 15 | { 16 | QCoreApplication app(argc, argv); 17 | testing::InitGoogleTest(&argc, argv); 18 | installCustomTestPrinter(new CustomPrinter); 19 | int results = RUN_ALL_TESTS(); 20 | QTimer::singleShot(0, &app, &QCoreApplication::quit); 21 | app.exec(); 22 | return results; 23 | } 24 | -------------------------------------------------------------------------------- /tests/gtest/tests/networkmock.h: -------------------------------------------------------------------------------- 1 | #ifndef NETWORK_MOCK_H 2 | #define NETWORK_MOCK_H 3 | 4 | #include 5 | #include 6 | #ifndef QT_NO_SSL 7 | #include 8 | #endif // QT_NO_SSL 9 | 10 | class NetworkMock : public QMQTT::NetworkInterface 11 | { 12 | public: 13 | MOCK_METHOD1(sendFrame, void(const QMQTT::Frame&)); 14 | MOCK_CONST_METHOD0(isConnectedToHost, bool()); 15 | MOCK_CONST_METHOD0(autoReconnect, bool()); 16 | MOCK_METHOD1(setAutoReconnect, void(const bool)); 17 | MOCK_CONST_METHOD0(autoReconnectInterval, int()); 18 | MOCK_METHOD1(setAutoReconnectInterval, void(const int)); 19 | MOCK_CONST_METHOD0(state, QAbstractSocket::SocketState()); 20 | MOCK_METHOD2(connectToHost, void(const QHostAddress&, const quint16)); 21 | MOCK_METHOD2(connectToHost, void(const QString&, const quint16)); 22 | MOCK_METHOD0(disconnectFromHost, void()); 23 | #ifndef QT_NO_SSL 24 | MOCK_METHOD1(ignoreSslErrors, void(const QList&)); 25 | MOCK_METHOD0(ignoreSslErrors, void()); 26 | MOCK_CONST_METHOD0(sslConfiguration, QSslConfiguration()); 27 | MOCK_METHOD1(setSslConfiguration, void(const QSslConfiguration&)); 28 | #endif // QT_NO_SSL 29 | }; 30 | 31 | #endif // NETWORK_MOCK_H 32 | -------------------------------------------------------------------------------- /tests/gtest/tests/routedmessagetests.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | class RoutedMessageTests : public QObject 6 | { 7 | Q_OBJECT 8 | public: 9 | explicit RoutedMessageTests(); 10 | virtual ~RoutedMessageTests(); 11 | 12 | QScopedPointer _uut; 13 | 14 | private slots: 15 | void init(); 16 | void cleanup(); 17 | 18 | void constructor_Test(); 19 | }; 20 | 21 | RoutedMessageTests::RoutedMessageTests() 22 | : _uut(nullptr) 23 | { 24 | } 25 | 26 | RoutedMessageTests::~RoutedMessageTests() 27 | { 28 | } 29 | 30 | void RoutedMessageTests::init() 31 | { 32 | _uut.reset(new QMQTT::RoutedMessage(QMQTT::Message())); 33 | } 34 | 35 | void RoutedMessageTests::cleanup() 36 | { 37 | _uut.reset(); 38 | } 39 | 40 | void RoutedMessageTests::constructor_Test() 41 | { 42 | QCOMPARE(_uut->message(), QMQTT::Message()); 43 | QHash emptyHash; 44 | QCOMPARE(_uut->parameters(), emptyHash); 45 | } 46 | 47 | QTEST_MAIN(RoutedMessageTests); 48 | #include "routedmessagetests.moc" 49 | -------------------------------------------------------------------------------- /tests/gtest/tests/routertests.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | //#include 5 | #include 6 | #include 7 | 8 | class RouterTests : public QObject 9 | { 10 | Q_OBJECT 11 | public: 12 | explicit RouterTests(); 13 | virtual ~RouterTests(); 14 | 15 | QScopedPointer _client; 16 | QScopedPointer _uut; 17 | 18 | private slots: 19 | void init(); 20 | void cleanup(); 21 | 22 | void subscribe_Test(); 23 | }; 24 | 25 | RouterTests::RouterTests() 26 | : _uut(nullptr) 27 | { 28 | } 29 | 30 | RouterTests::~RouterTests() 31 | { 32 | } 33 | 34 | void RouterTests::init() 35 | { 36 | // _client.reset(new QMQTT::Client); 37 | // _uut.reset(new QMQTT::Router(_client.data())); 38 | } 39 | 40 | void RouterTests::cleanup() 41 | { 42 | // _uut.reset(); 43 | // _client.reset(); 44 | } 45 | 46 | void RouterTests::subscribe_Test() 47 | { 48 | // QMQTT::RouteSubscription* subscription = _uut->subscribe("route"); 49 | // QVERIFY(nullptr != subscription); 50 | // QCOMPARE(subscription->route(), QString("route")); 51 | } 52 | 53 | // todo: need to figure out how to test subscribe a little better 54 | 55 | QTEST_MAIN(RouterTests); 56 | #include "routertests.moc" 57 | -------------------------------------------------------------------------------- /tests/gtest/tests/routesubscriptiontests.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | class RouteSubscriptionTests : public QObject 6 | { 7 | Q_OBJECT 8 | public: 9 | explicit RouteSubscriptionTests(); 10 | virtual ~RouteSubscriptionTests(); 11 | 12 | QScopedPointer _uut; 13 | 14 | private slots: 15 | void init(); 16 | void cleanup(); 17 | 18 | // todo: can't really test directly here, only Route class can insantiate for now 19 | }; 20 | 21 | RouteSubscriptionTests::RouteSubscriptionTests() 22 | : _uut(nullptr) 23 | { 24 | } 25 | 26 | RouteSubscriptionTests::~RouteSubscriptionTests() 27 | { 28 | } 29 | 30 | void RouteSubscriptionTests::init() 31 | { 32 | _uut.reset(); 33 | } 34 | 35 | void RouteSubscriptionTests::cleanup() 36 | { 37 | _uut.reset(); 38 | } 39 | 40 | QTEST_MAIN(RouteSubscriptionTests); 41 | #include "routesubscriptiontests.moc" 42 | -------------------------------------------------------------------------------- /tests/gtest/tests/socketmock.h: -------------------------------------------------------------------------------- 1 | #ifndef SOCKET_MOCK_H 2 | #define SOCKET_MOCK_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include "iodevicemock.h" 8 | 9 | class SocketMock : public QMQTT::SocketInterface 10 | { 11 | public: 12 | SocketMock(QObject* parent = nullptr) 13 | : QMQTT::SocketInterface (parent) 14 | , mockIoDevice(new IODeviceMock) 15 | { 16 | mockIoDevice->open(QIODevice::ReadWrite); 17 | } 18 | 19 | QScopedPointer mockIoDevice; 20 | 21 | virtual QIODevice *ioDevice() 22 | { 23 | return mockIoDevice.data(); 24 | } 25 | 26 | using QMQTT::SocketInterface::error; 27 | MOCK_METHOD2(connectToHost, void(const QHostAddress&, quint16)); 28 | MOCK_METHOD2(connectToHost, void(const QString&, quint16)); 29 | MOCK_METHOD0(disconnectFromHost, void()); 30 | MOCK_CONST_METHOD0(state, QAbstractSocket::SocketState()); 31 | MOCK_CONST_METHOD0(error, QAbstractSocket::SocketError()); 32 | }; 33 | 34 | #endif // SOCKET_MOCK_H 35 | -------------------------------------------------------------------------------- /tests/gtest/tests/tcpserver.cpp: -------------------------------------------------------------------------------- 1 | #include "tcpserver.h" 2 | #include 3 | #include 4 | 5 | TcpServer::TcpServer(const QHostAddress host, const quint16 port) 6 | : _socket(nullptr) 7 | { 8 | connect(this, &QTcpServer::newConnection, this, &TcpServer::on_newConnection); 9 | listen(host, port); 10 | } 11 | 12 | TcpServer::~TcpServer() 13 | { 14 | } 15 | 16 | void TcpServer::on_newConnection() 17 | { 18 | if(nullptr != _socket) 19 | { 20 | disconnect(_socket, &QTcpSocket::readyRead, this, &TcpServer::on_readyRead); 21 | _socket->disconnectFromHost(); 22 | _socket->deleteLater(); 23 | _socket = nullptr; 24 | _data.clear(); 25 | } 26 | _socket = nextPendingConnection(); 27 | if(nullptr != _socket) 28 | { 29 | connect(_socket, &QTcpSocket::readyRead, this, &TcpServer::on_readyRead); 30 | } 31 | } 32 | 33 | void TcpServer::on_readyRead() 34 | { 35 | _data.append(_socket->readAll()); 36 | } 37 | 38 | QByteArray TcpServer::data() const 39 | { 40 | return _data; 41 | } 42 | 43 | QTcpSocket* TcpServer::socket() const 44 | { 45 | return _socket; 46 | } 47 | -------------------------------------------------------------------------------- /tests/gtest/tests/tcpserver.h: -------------------------------------------------------------------------------- 1 | #ifndef TCP_SERVER_H 2 | #define TCP_SERVER_H 3 | 4 | #include 5 | #include 6 | 7 | class TcpServer : public QTcpServer 8 | { 9 | Q_OBJECT 10 | public: 11 | explicit TcpServer(const QHostAddress host, const quint16 port); 12 | virtual ~TcpServer(); 13 | 14 | QByteArray data() const; 15 | QTcpSocket* socket() const; 16 | 17 | static const QHostAddress HOST; 18 | static const quint16 PORT; 19 | 20 | protected: 21 | QTcpSocket* _socket; 22 | QByteArray _data; 23 | 24 | protected Q_SLOTS: 25 | void on_newConnection(); 26 | void on_readyRead(); 27 | }; 28 | 29 | #endif // TCP_SERVER_H 30 | -------------------------------------------------------------------------------- /tests/gtest/tests/tests.pro: -------------------------------------------------------------------------------- 1 | TARGET = qmqtt_tests 2 | QT = core network qmqtt qmqtt-private testlib 3 | 4 | DEFINES += QMQTT_LIBRARY_TESTS 5 | 6 | SOURCES += \ 7 | clienttest.cpp \ 8 | tcpserver.cpp \ 9 | main.cpp \ 10 | customprinter.cpp \ 11 | networktest.cpp \ 12 | messagetest.cpp \ 13 | frametest.cpp \ 14 | sockettest.cpp 15 | 16 | HEADERS += \ 17 | tcpserver.h \ 18 | customprinter.h \ 19 | networkmock.h \ 20 | socketmock.h \ 21 | timermock.h \ 22 | iodevicemock.h 23 | 24 | INCLUDEPATH += \ 25 | ../gtest/googletest/googletest/include \ 26 | ../gtest/googletest/googlemock/include 27 | LIBS += -L../gtest -L../gtest/debug -L../gtest/release -lgtest 28 | 29 | unix:!NO_UNIT_TESTS:!NO_RUN_UNIT_TESTS: { 30 | unit_tests.target = all 31 | macx: unit_tests.commands = \ 32 | install_name_tool -change libgtest.1.dylib $${OUT_PWD}/../gtest/libgtest.1.dylib $${OUT_PWD}/qmqtt_tests.app/Contents/MacOS/qmqtt_tests; \ 33 | $${OUT_PWD}/qmqtt_tests.app/Contents/MacOS/qmqtt_tests 34 | else: unit_tests.commands = \ 35 | LD_LIBRARY_PATH=$${OUT_PWD}/../gtest \ 36 | $${OUT_PWD}/qmqtt_tests 37 | QMAKE_EXTRA_TARGETS += unit_tests 38 | } 39 | -------------------------------------------------------------------------------- /tests/gtest/tests/tests.qbs: -------------------------------------------------------------------------------- 1 | import qbs 2 | import qbs.Process 3 | 4 | Product { 5 | name: "Tests" 6 | type: [ 7 | "application", 8 | ] 9 | targetName: "qmqtt_tests" 10 | 11 | cpp.defines: [ 12 | "QMQTT_LIBRARY_TESTS" 13 | ] 14 | 15 | files: [ 16 | "clienttest.cpp", 17 | "tcpserver.cpp", 18 | "main.cpp", 19 | "customprinter.cpp", 20 | "networktest.cpp", 21 | "messagetest.cpp", 22 | "frametest.cpp", 23 | "sockettest.cpp", 24 | "tcpserver.h", 25 | "customprinter.h", 26 | "networkmock.h", 27 | "socketmock.h", 28 | "timermock.h", 29 | "iodevicemock.h", 30 | ] 31 | 32 | Depends { 33 | name: "Qt" 34 | submodules: [ 35 | "core", 36 | "network", 37 | "testlib", 38 | ] 39 | } 40 | 41 | Depends { 42 | name: "Google-Test" 43 | } 44 | 45 | Depends { 46 | name: "qmqtt" 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /tests/gtest/tests/timermock.h: -------------------------------------------------------------------------------- 1 | #ifndef TIMER_MOCK_H 2 | #define TIMER_MOCK_H 3 | 4 | #include 5 | #include 6 | 7 | class TimerMock : public QMQTT::TimerInterface 8 | { 9 | public: 10 | MOCK_CONST_METHOD0(isSingleShot, bool()); 11 | MOCK_METHOD1(setSingleShot, void(bool)); 12 | MOCK_CONST_METHOD0(interval, int()); 13 | MOCK_METHOD1(setInterval, void(int)); 14 | MOCK_METHOD0(start, void()); 15 | MOCK_METHOD0(stop, void()); 16 | }; 17 | 18 | #endif // TIMER_MOCK_H 19 | -------------------------------------------------------------------------------- /tests/tests.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | SUBDIRS += \ 3 | auto 4 | 5 | unix:!NO_UNIT_TESTS: SUBDIRS += gtest 6 | 7 | # benchmarks in debug mode is rarely sensible 8 | contains(QT_CONFIG, release): SUBDIRS += benchmarks 9 | -------------------------------------------------------------------------------- /tests/tests.qbs: -------------------------------------------------------------------------------- 1 | import qbs 2 | 3 | Project { 4 | name: "Tests" 5 | /* NOTE: to change this just add "Tests.buildUnitTests:false" or "Tests.buildUnitTests:true" to qbs call */ 6 | property bool buildUnitTests: true 7 | 8 | references: [ 9 | "auto" 10 | ] 11 | 12 | SubProject { 13 | filePath: "gtest/gtest.qbs" 14 | Properties { 15 | condition: qbs.targetOS.contains("unix") && buildUnitTests 16 | } 17 | } 18 | } 19 | --------------------------------------------------------------------------------