%global _empty_manifest_terminate_build 0 Name: python-gunit Version: 0.1.58 Release: 1 Summary: App for unit testing with GDB License: MIT URL: https://github.com/estcube/GUnit Source0: https://mirrors.nju.edu.cn/pypi/web/packages/02/df/3da104026a7cec37118ab1230b4762aa23da5e9a1589ecde29072ae36883/gunit-0.1.58.tar.gz BuildArch: noarch Requires: python3-junit-xml %description # GUnit App for executing C/C++ unit tests using GDB. Documentation: https://github.com/estcube/GUnit/wiki ## Installation The easiest way to install Gunit is through pip: https://pypi.org/project/gunit/ ```bash pip install gunit ``` ## Example For example if OpenOCD is used as GDB server and we are testing on an ARM chip. Please note that you need to have the openOCD server running in the background. Secondly, all the outputs will be put into ``gunit`` directory. To specify where the directory will be generated, define ``build_dir`` argument for the constructor. By default, it will be your current working directory. ```python from gunit import GUnit # Create a GUnit object for OpenOCD gunit = GUnit.openOCD("localhost:9000", executable='arm-none-eabi-gdb') # Execute the tests in the compiled file gunit.test("test.elf") # Construct a JUnit test report gunit.junit() ``` Here you can see a simple example of the .cpp file that could be used with the python example above. ```cpp #include "GUnit.hpp" gunit::test t1( "test1", // Name of the test case [](){ // Lambda expression gunit::affirm(20) > 10; // The test case to check } ); gunit::test t2("test2", [](){ gunit::affirm(10) > 20; gunit::affirm(11) > 20; }); gunit::test t3("test3", [](){ std::list l1 = std::list(); l1.push_back(10); l1.push_back(12); l1.push_back(14); std::list l2 = std::list(); l2.push_back(10); l2.push_back(12); l2.push_back(14); gunit::affirm(l1) == l2; }); gunit::test t4("test4", [](){ std::list l1 = std::list(); l1.push_back(10); l1.push_back(12); l1.push_back(14); std::list l2 = std::list(); l2.push_back(10); l2.push_back(22); l2.push_back(34); gunit::affirm(l1) == l2; }); gunit::test t5("test5", [](){ struct a { int b; char c; char d; char e; char f; }; struct a one(10, 'a', 'e', 'i', 'o'); struct a two(10, 'a', 'e', 'i', 'o'); gunit::affirm(one) == two; }); gunit::test t6("test6", [](){ struct a { int b; char c; char d; char e; char f; }; struct a one(10, 'a', 'e', 'i', 'o'); struct a two(22, 'x', 'e', 'o', 'm'); gunit::affirm(one) == two; }); gunit::test t7("test7", [](){ gunit::affirm(10) > 5; gunit::affirm(10) >= 10; gunit::affirm(10) <= 10; gunit::affirm(10) <= 15; gunit::affirm(1.0) == 1.0; gunit::affirm(2.0) != 1.0; }); int main() { gunit::suite::run(); // The test are added into the global test list on creation of the test struct gunit::end(); // Signal the end of the unit test while(1); } ``` %package -n python3-gunit Summary: App for unit testing with GDB Provides: python-gunit BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-gunit # GUnit App for executing C/C++ unit tests using GDB. Documentation: https://github.com/estcube/GUnit/wiki ## Installation The easiest way to install Gunit is through pip: https://pypi.org/project/gunit/ ```bash pip install gunit ``` ## Example For example if OpenOCD is used as GDB server and we are testing on an ARM chip. Please note that you need to have the openOCD server running in the background. Secondly, all the outputs will be put into ``gunit`` directory. To specify where the directory will be generated, define ``build_dir`` argument for the constructor. By default, it will be your current working directory. ```python from gunit import GUnit # Create a GUnit object for OpenOCD gunit = GUnit.openOCD("localhost:9000", executable='arm-none-eabi-gdb') # Execute the tests in the compiled file gunit.test("test.elf") # Construct a JUnit test report gunit.junit() ``` Here you can see a simple example of the .cpp file that could be used with the python example above. ```cpp #include "GUnit.hpp" gunit::test t1( "test1", // Name of the test case [](){ // Lambda expression gunit::affirm(20) > 10; // The test case to check } ); gunit::test t2("test2", [](){ gunit::affirm(10) > 20; gunit::affirm(11) > 20; }); gunit::test t3("test3", [](){ std::list l1 = std::list(); l1.push_back(10); l1.push_back(12); l1.push_back(14); std::list l2 = std::list(); l2.push_back(10); l2.push_back(12); l2.push_back(14); gunit::affirm(l1) == l2; }); gunit::test t4("test4", [](){ std::list l1 = std::list(); l1.push_back(10); l1.push_back(12); l1.push_back(14); std::list l2 = std::list(); l2.push_back(10); l2.push_back(22); l2.push_back(34); gunit::affirm(l1) == l2; }); gunit::test t5("test5", [](){ struct a { int b; char c; char d; char e; char f; }; struct a one(10, 'a', 'e', 'i', 'o'); struct a two(10, 'a', 'e', 'i', 'o'); gunit::affirm(one) == two; }); gunit::test t6("test6", [](){ struct a { int b; char c; char d; char e; char f; }; struct a one(10, 'a', 'e', 'i', 'o'); struct a two(22, 'x', 'e', 'o', 'm'); gunit::affirm(one) == two; }); gunit::test t7("test7", [](){ gunit::affirm(10) > 5; gunit::affirm(10) >= 10; gunit::affirm(10) <= 10; gunit::affirm(10) <= 15; gunit::affirm(1.0) == 1.0; gunit::affirm(2.0) != 1.0; }); int main() { gunit::suite::run(); // The test are added into the global test list on creation of the test struct gunit::end(); // Signal the end of the unit test while(1); } ``` %package help Summary: Development documents and examples for gunit Provides: python3-gunit-doc %description help # GUnit App for executing C/C++ unit tests using GDB. Documentation: https://github.com/estcube/GUnit/wiki ## Installation The easiest way to install Gunit is through pip: https://pypi.org/project/gunit/ ```bash pip install gunit ``` ## Example For example if OpenOCD is used as GDB server and we are testing on an ARM chip. Please note that you need to have the openOCD server running in the background. Secondly, all the outputs will be put into ``gunit`` directory. To specify where the directory will be generated, define ``build_dir`` argument for the constructor. By default, it will be your current working directory. ```python from gunit import GUnit # Create a GUnit object for OpenOCD gunit = GUnit.openOCD("localhost:9000", executable='arm-none-eabi-gdb') # Execute the tests in the compiled file gunit.test("test.elf") # Construct a JUnit test report gunit.junit() ``` Here you can see a simple example of the .cpp file that could be used with the python example above. ```cpp #include "GUnit.hpp" gunit::test t1( "test1", // Name of the test case [](){ // Lambda expression gunit::affirm(20) > 10; // The test case to check } ); gunit::test t2("test2", [](){ gunit::affirm(10) > 20; gunit::affirm(11) > 20; }); gunit::test t3("test3", [](){ std::list l1 = std::list(); l1.push_back(10); l1.push_back(12); l1.push_back(14); std::list l2 = std::list(); l2.push_back(10); l2.push_back(12); l2.push_back(14); gunit::affirm(l1) == l2; }); gunit::test t4("test4", [](){ std::list l1 = std::list(); l1.push_back(10); l1.push_back(12); l1.push_back(14); std::list l2 = std::list(); l2.push_back(10); l2.push_back(22); l2.push_back(34); gunit::affirm(l1) == l2; }); gunit::test t5("test5", [](){ struct a { int b; char c; char d; char e; char f; }; struct a one(10, 'a', 'e', 'i', 'o'); struct a two(10, 'a', 'e', 'i', 'o'); gunit::affirm(one) == two; }); gunit::test t6("test6", [](){ struct a { int b; char c; char d; char e; char f; }; struct a one(10, 'a', 'e', 'i', 'o'); struct a two(22, 'x', 'e', 'o', 'm'); gunit::affirm(one) == two; }); gunit::test t7("test7", [](){ gunit::affirm(10) > 5; gunit::affirm(10) >= 10; gunit::affirm(10) <= 10; gunit::affirm(10) <= 15; gunit::affirm(1.0) == 1.0; gunit::affirm(2.0) != 1.0; }); int main() { gunit::suite::run(); // The test are added into the global test list on creation of the test struct gunit::end(); // Signal the end of the unit test while(1); } ``` %prep %autosetup -n gunit-0.1.58 %build %py3_build %install %py3_install install -d -m755 %{buildroot}/%{_pkgdocdir} if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi pushd %{buildroot} if [ -d usr/lib ]; then find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/lib64 ]; then find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/bin ]; then find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/sbin ]; then find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst fi touch doclist.lst if [ -d usr/share/man ]; then find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst fi popd mv %{buildroot}/filelist.lst . mv %{buildroot}/doclist.lst . %files -n python3-gunit -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Tue May 30 2023 Python_Bot - 0.1.58-1 - Package Spec generated