├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── build.bat ├── changelog.md ├── samples ├── README.md ├── myoddweb.directorywatcher.load │ ├── Drives.cs │ ├── ILoad.cs │ ├── Load.cs │ ├── Options.cs │ ├── Output │ │ ├── Console.cs │ │ ├── IOutput.cs │ │ └── Noop.cs │ ├── Program.cs │ ├── Random.cs │ ├── WatchedFolder.cs │ └── myoddweb.directorywatcher.load.csproj ├── myoddweb.directorywatcher.ref.sln ├── myoddweb.directorywatcher.sample │ ├── App.config │ ├── ConsoleWatch.cs │ ├── Program.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── myoddweb.directorywatcher.sample.csproj │ ├── myoddweb.directorywatcher.sample.ref.csproj │ └── packages.config ├── myoddweb.directorywatcher.sln └── nonblocking │ ├── Program.cs │ └── nonblocking.csproj ├── src ├── myoddweb.directorywatcher.interfaces │ ├── EventAction.cs │ ├── EventError.cs │ ├── IEvent.cs │ ├── IEventError.cs │ ├── IFileSystemEvent.cs │ ├── ILoggerEvent.cs │ ├── IRates.cs │ ├── IRenamedFileSystemEvent.cs │ ├── IRequest.cs │ ├── IStatistics.cs │ ├── IWatcher1.cs │ ├── IWatcher2.cs │ ├── IWatcher3.cs │ ├── IWatcherEvents.cs │ ├── LogLevel.cs │ └── myoddweb.directorywatcher.interfaces.csproj ├── myoddweb.directorywatcher.sln ├── myoddweb.directorywatcher.snk ├── myoddweb.directorywatcher.test │ ├── HelperTest.cs │ ├── LoggerEventTest.cs │ ├── RatesTests.cs │ ├── RequestTests.cs │ ├── WatcherAddTests.cs │ ├── WatcherTests.cs │ ├── myoddweb.directorywatcher.test.csproj │ └── utils │ │ ├── EventErrorTests.cs │ │ └── WatcherManagerTests.cs ├── myoddweb.directorywatcher.win.test │ ├── CollectorTests.cpp │ ├── IoTests.cpp │ ├── MonitorDataTests.cpp │ ├── MonitorsManagerEdge.cpp │ ├── MonitorsManagerTestHelper.cpp │ ├── MonitorsManagerTestHelper.h │ ├── MonitorsManagerTestsAdd.cpp │ ├── MonitorsManagerTestsDelete.cpp │ ├── RequestTest.cpp │ ├── RequestTestHelper.h │ ├── WorkerHelper.h │ ├── WorkerPoolTest.cpp │ ├── WorkerTest.cpp │ ├── myoddweb.directorywatcher.win.test.vcxproj │ ├── myoddweb.directorywatcher.win.test.vcxproj.filters │ ├── pch.cpp │ └── pch.h ├── myoddweb.directorywatcher.win │ ├── monitors │ │ ├── Base.h │ │ ├── Callbacks.h │ │ ├── EventsPublisher.cpp │ │ ├── EventsPublisher.h │ │ ├── Monitor.cpp │ │ ├── Monitor.h │ │ ├── MultipleWinMonitor.cpp │ │ ├── MultipleWinMonitor.h │ │ ├── WinMonitor.cpp │ │ ├── WinMonitor.h │ │ └── win │ │ │ ├── Common.cpp │ │ │ ├── Common.h │ │ │ ├── Data.cpp │ │ │ ├── Data.h │ │ │ ├── Directories.cpp │ │ │ ├── Directories.h │ │ │ ├── Files.cpp │ │ │ └── Files.h │ ├── myoddweb.directorywatcher.vcxproj.filters │ ├── myoddweb.directorywatcher.win.rc │ ├── myoddweb.directorywatcher.win.vcxproj.filters │ ├── myoddweb.directorywatcher.win.x64.vcxproj │ ├── myoddweb.directorywatcher.win.x64.vcxproj.filters │ ├── myoddweb.directorywatcher.win.x86.vcxproj │ ├── myoddweb.directorywatcher.win.x86.vcxproj.filters │ ├── resource.h │ ├── stdafx.cpp │ ├── stdafx.h │ ├── targetver.h │ ├── utils │ │ ├── Collector.cpp │ │ ├── Collector.h │ │ ├── Event.h │ │ ├── EventAction.h │ │ ├── EventError.h │ │ ├── EventInformation.h │ │ ├── Instrumentor.h │ │ ├── Io.cpp │ │ ├── Io.h │ │ ├── Lock.cpp │ │ ├── Lock.h │ │ ├── LogLevel.h │ │ ├── Logger.cpp │ │ ├── Logger.h │ │ ├── MonitorsManager.cpp │ │ ├── MonitorsManager.h │ │ ├── Request.cpp │ │ ├── Request.h │ │ ├── Threads │ │ │ ├── CallbackWorker.cpp │ │ │ ├── CallbackWorker.h │ │ │ ├── Thread.cpp │ │ │ ├── Thread.h │ │ │ ├── WaitResult.h │ │ │ ├── Worker.cpp │ │ │ ├── Worker.h │ │ │ ├── WorkerId.cpp │ │ │ ├── WorkerId.h │ │ │ ├── WorkerPool.cpp │ │ │ └── WorkerPool.h │ │ ├── Wait.cpp │ │ └── Wait.h │ ├── watcher.cpp │ └── watcher.h ├── myoddweb.directorywatcher │ ├── Rates.cs │ ├── Request.cs │ ├── Watcher.cs │ ├── myoddweb.directorywatcher.csproj │ ├── myoddweb.directorywatcher.nuspec │ └── utils │ │ ├── EventError.cs │ │ ├── Helper │ │ ├── Delegates.cs │ │ ├── Event.cs │ │ ├── FileSystemEvent.cs │ │ ├── LoggerEvent.cs │ │ ├── NativeLibrary.cs │ │ ├── RenamedFileSystemEvent.cs │ │ ├── Statistics.cs │ │ └── WatcherManagerNativeLibrary.cs │ │ ├── TypeLoader.cs │ │ ├── WatcherManager.cs │ │ ├── WatcherManagerEmbeddedLoadLibrary.cs │ │ └── WatcherManagerLoadLibrary.cs └── packages │ └── googletest-release-1.10.0 │ ├── .clang-format │ ├── .gitignore │ ├── .travis.yml │ ├── BUILD.bazel │ ├── CMakeLists.txt │ ├── CONTRIBUTING.md │ ├── LICENSE │ ├── README.md │ ├── WORKSPACE │ ├── appveyor.yml │ ├── ci │ ├── build-linux-bazel.sh │ ├── build-platformio.sh │ ├── env-linux.sh │ ├── env-osx.sh │ ├── get-nprocessors.sh │ ├── install-linux.sh │ ├── install-osx.sh │ ├── install-platformio.sh │ ├── log-config.sh │ └── travis.sh │ ├── googlemock │ ├── CMakeLists.txt │ ├── CONTRIBUTORS │ ├── LICENSE │ ├── README.md │ ├── cmake │ │ ├── gmock.pc.in │ │ └── gmock_main.pc.in │ ├── docs │ │ ├── cheat_sheet.md │ │ ├── cook_book.md │ │ ├── for_dummies.md │ │ └── gmock_faq.md │ ├── include │ │ └── gmock │ │ │ ├── gmock-actions.h │ │ │ ├── gmock-cardinalities.h │ │ │ ├── gmock-function-mocker.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-matchers.h │ │ │ ├── gmock-more-actions.h │ │ │ ├── gmock-more-matchers.h │ │ │ ├── gmock-nice-strict.h │ │ │ ├── gmock-spec-builders.h │ │ │ ├── gmock.h │ │ │ └── internal │ │ │ ├── custom │ │ │ ├── README.md │ │ │ ├── gmock-generated-actions.h │ │ │ ├── gmock-generated-actions.h.pump │ │ │ ├── gmock-matchers.h │ │ │ └── gmock-port.h │ │ │ ├── gmock-internal-utils.h │ │ │ ├── gmock-port.h │ │ │ └── gmock-pp.h │ ├── 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 │ │ ├── BUILD.bazel │ │ ├── gmock-actions_test.cc │ │ ├── gmock-cardinalities_test.cc │ │ ├── gmock-function-mocker_nc.cc │ │ ├── gmock-function-mocker_nc_test.py │ │ ├── gmock-function-mocker_test.cc │ │ ├── gmock-generated-actions_test.cc │ │ ├── gmock-generated-function-mockers_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-pp-string_test.cc │ │ ├── gmock-pp_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 │ ├── CMakeLists.txt │ ├── CONTRIBUTORS │ ├── LICENSE │ ├── README.md │ ├── cmake │ │ ├── Config.cmake.in │ │ ├── gtest.pc.in │ │ ├── gtest_main.pc.in │ │ ├── internal_utils.cmake │ │ └── libgtest.la.in │ ├── docs │ │ ├── advanced.md │ │ ├── faq.md │ │ ├── pkgconfig.md │ │ ├── primer.md │ │ ├── pump_manual.md │ │ └── samples.md │ ├── include │ │ └── gtest │ │ │ ├── gtest-death-test.h │ │ │ ├── gtest-matchers.h │ │ │ ├── gtest-message.h │ │ │ ├── gtest-param-test.h │ │ │ ├── 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 │ │ │ ├── README.md │ │ │ ├── gtest-port.h │ │ │ ├── gtest-printers.h │ │ │ └── gtest.h │ │ │ ├── gtest-death-test-internal.h │ │ │ ├── gtest-filepath.h │ │ │ ├── gtest-internal.h │ │ │ ├── gtest-param-util.h │ │ │ ├── gtest-port-arch.h │ │ │ ├── gtest-port.h │ │ │ ├── gtest-string.h │ │ │ ├── gtest-type-util.h │ │ │ └── gtest-type-util.h.pump │ ├── 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 │ │ ├── upload.py │ │ └── upload_gtest.py │ ├── src │ │ ├── gtest-all.cc │ │ ├── gtest-death-test.cc │ │ ├── gtest-filepath.cc │ │ ├── gtest-internal-inl.h │ │ ├── gtest-matchers.cc │ │ ├── gtest-port.cc │ │ ├── gtest-printers.cc │ │ ├── gtest-test-part.cc │ │ ├── gtest-typed-test.cc │ │ ├── gtest.cc │ │ └── gtest_main.cc │ └── test │ │ ├── BUILD.bazel │ │ ├── googletest-break-on-failure-unittest.py │ │ ├── googletest-break-on-failure-unittest_.cc │ │ ├── googletest-catch-exceptions-test.py │ │ ├── googletest-catch-exceptions-test_.cc │ │ ├── googletest-color-test.py │ │ ├── googletest-color-test_.cc │ │ ├── googletest-death-test-test.cc │ │ ├── googletest-death-test_ex_test.cc │ │ ├── googletest-env-var-test.py │ │ ├── googletest-env-var-test_.cc │ │ ├── googletest-filepath-test.cc │ │ ├── googletest-filter-unittest.py │ │ ├── googletest-filter-unittest_.cc │ │ ├── googletest-json-outfiles-test.py │ │ ├── googletest-json-output-unittest.py │ │ ├── googletest-list-tests-unittest.py │ │ ├── googletest-list-tests-unittest_.cc │ │ ├── googletest-listener-test.cc │ │ ├── googletest-message-test.cc │ │ ├── googletest-options-test.cc │ │ ├── googletest-output-test-golden-lin.txt │ │ ├── googletest-output-test.py │ │ ├── googletest-output-test_.cc │ │ ├── googletest-param-test-invalid-name1-test.py │ │ ├── googletest-param-test-invalid-name1-test_.cc │ │ ├── googletest-param-test-invalid-name2-test.py │ │ ├── googletest-param-test-invalid-name2-test_.cc │ │ ├── googletest-param-test-test.cc │ │ ├── googletest-param-test-test.h │ │ ├── googletest-param-test2-test.cc │ │ ├── googletest-port-test.cc │ │ ├── googletest-printers-test.cc │ │ ├── googletest-shuffle-test.py │ │ ├── googletest-shuffle-test_.cc │ │ ├── googletest-test-part-test.cc │ │ ├── googletest-test2_test.cc │ │ ├── googletest-throw-on-failure-test.py │ │ ├── googletest-throw-on-failure-test_.cc │ │ ├── googletest-uninitialized-test.py │ │ ├── googletest-uninitialized-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_assert_by_exception_test.cc │ │ ├── gtest_environment_test.cc │ │ ├── gtest_help_test.py │ │ ├── gtest_help_test_.cc │ │ ├── gtest_json_test_utils.py │ │ ├── gtest_list_output_unittest.py │ │ ├── gtest_list_output_unittest_.cc │ │ ├── gtest_main_unittest.cc │ │ ├── gtest_no_test_unittest.cc │ │ ├── gtest_pred_impl_unittest.cc │ │ ├── gtest_premature_exit_test.cc │ │ ├── gtest_prod_test.cc │ │ ├── gtest_repeat_test.cc │ │ ├── gtest_skip_environment_check_output_test.py │ │ ├── gtest_skip_in_environment_setup_test.cc │ │ ├── gtest_skip_test.cc │ │ ├── gtest_sole_header_test.cc │ │ ├── gtest_stress_test.cc │ │ ├── gtest_test_macro_stack_footprint_test.cc │ │ ├── gtest_test_utils.py │ │ ├── gtest_testbridge_test.py │ │ ├── gtest_testbridge_test_.cc │ │ ├── gtest_throw_on_failure_ex_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 │ ├── library.json │ └── platformio.ini ├── testing.md └── tools └── nuget └── nuget.exe /.travis.yml: -------------------------------------------------------------------------------- 1 | language: csharp 2 | os: windows 3 | solution: src/myoddweb.directorywatcher.sln 4 | 5 | before_install: 6 | - sudo apt-get install nunit-console 7 | before_script: 8 | - nuget restore src/myoddweb.directorywatcher.sln 9 | 10 | script: 11 | - msbuild /p:Configuration=Debug src/myoddweb.directorywatcher.sln 12 | 13 | notifications: 14 | - email: false 15 | 16 | # whitelist 17 | branches: 18 | only: 19 | - master 20 | - develop -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Florent Guelfucci 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /build.bat: -------------------------------------------------------------------------------- 1 | @IF "%~1" == "" GOTO Error 2 | @IF "%~1" == "/t:Push" GOTO Push 3 | @IF "%~1" == "/t:Pack" GOTO Pack 4 | 5 | @rem build the x32 version and make sure the new version is in \src\bin\Release\Win32 6 | @rem build the x64 version and make sure the new version is in \src\bin\Release\x64 7 | @rem to pack call "build /t:Pack" 8 | 9 | 10 | :Pack 11 | @rem remember to update .\src\myoddweb.directorywatcher\myoddweb.directorywatcher.nuspec to correct version number. 12 | @rem Install-Package MyOddWeb.DirectoryWatcher -Version 0.1.9 -Source ..\src\bin\ 13 | .\tools\nuget\Nuget.exe pack ".\src\myoddweb.directorywatcher\myoddweb.directorywatcher.nuspec" -OutputDirectory ".\src\bin\." 14 | 15 | @GOTO End 16 | 17 | :Push 18 | @echo You will need to push it manually or use 19 | @echo .\tools\nuget\Nuget.exe push .\src\bin\Myoddweb.DirectoryWatcher.0.1.9.nupkg 20 | 21 | @GOTO End 22 | 23 | :Error 24 | @echo Missing parametters, '/t:pack' or '/t:push' 25 | 26 | :End -------------------------------------------------------------------------------- /samples/README.md: -------------------------------------------------------------------------------- 1 | # Samples 2 | 3 | This is where we will try and add sample projects. 4 | 5 | ## myoddweb.directorywatcher.sample 6 | 7 | Very simple sample to output all the changes to your directory using `MyOddWeb.DirectoryWatcher` as a nuget package 8 | 9 | ### The package ... 10 | 11 | ```powershell 12 | install-package MyOddWeb.DirectoryWatcher 13 | ``` 14 | 15 | ## myoddweb.directorywatcher.sample.ref 16 | 17 | Same as the `myoddweb.directorywatcher.sample` but it uses project references. 18 | 19 | It makes it easier to test/debug, (and generally see what is going on) 20 | -------------------------------------------------------------------------------- /samples/myoddweb.directorywatcher.load/ILoad.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace myoddweb.directorywatcher.load 4 | { 5 | public interface ILoad : IDisposable 6 | { 7 | /// 8 | /// Start the test runnint 9 | /// 10 | void Start(); 11 | 12 | /// 13 | /// Top the test running 14 | /// 15 | void Stop(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /samples/myoddweb.directorywatcher.load/Options.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using myoddweb.commandlineparser.Interfaces; 3 | 4 | namespace myoddweb.directorywatcher.load 5 | { 6 | internal class Options 7 | { 8 | public int Iterations {get;} 9 | 10 | public int Folders { get; } 11 | 12 | public int Change { get; } 13 | 14 | public bool Unique { get; } 15 | 16 | /// 17 | /// If we want to run a random check test 18 | /// 19 | public bool Random { get; } 20 | 21 | /// 22 | /// If we want to test all drives. 23 | /// 24 | public bool Drives { get; } 25 | 26 | /// 27 | /// If we want to display event messages or not. 28 | /// 29 | public bool Quiet { get; } 30 | 31 | public Options(ICommandlineParser arguments ) 32 | { 33 | // the number of iterations we want to run 34 | // this is how often we want to 'stop/start' watching a folder. 35 | Iterations = arguments.Get("i"); 36 | if (Iterations <= 0) 37 | { 38 | throw new ArgumentException("The number of iterations cannot be -ve or zero", nameof(Iterations)); 39 | } 40 | 41 | // the number of folders we want to watch. 42 | Folders = arguments.Get("f"); 43 | if (Folders <= 0) 44 | { 45 | throw new ArgumentException("The number of folders cannot be -ve or zero", nameof(Folders)); 46 | } 47 | 48 | // how often we want to change folder in seconds. 49 | Change = arguments.Get("c"); 50 | 51 | // unique watcher or share the same one between watchers. 52 | Unique = arguments.Get("u"); 53 | 54 | // display events messages or not? 55 | Quiet = arguments.Get("q"); 56 | 57 | // if we are testing the drive letters only. 58 | Drives = arguments.Get("d"); 59 | 60 | // are we testing for random events? 61 | Random = arguments.Get("r"); 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /samples/myoddweb.directorywatcher.load/Output/IOutput.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading; 3 | namespace myoddweb.directorywatcher.load.Output 4 | { 5 | internal interface IOutput : IDisposable 6 | { 7 | void AddMessage(string message, CancellationToken token); 8 | 9 | void AddInformationMessage(DateTime dt, string message, CancellationToken token); 10 | 11 | void AddWarningMessage( DateTime dt, string message, CancellationToken token); 12 | 13 | void AddErrorMessage( DateTime dt, string message, CancellationToken token); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /samples/myoddweb.directorywatcher.load/Output/Noop.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading; 3 | 4 | namespace myoddweb.directorywatcher.load.Output 5 | { 6 | public sealed class Noop : IOutput 7 | { 8 | public void AddMessage(string message, CancellationToken token) 9 | { 10 | // do nothing 11 | } 12 | 13 | public void AddInformationMessage(DateTime dt, string message, CancellationToken token) 14 | { 15 | // do nothing 16 | } 17 | 18 | public void AddWarningMessage(DateTime dt, string message, CancellationToken token) 19 | { 20 | // do nothing 21 | } 22 | 23 | public void AddErrorMessage(DateTime dt, string message, CancellationToken token) 24 | { 25 | // do nothing 26 | } 27 | 28 | public void Dispose() 29 | { 30 | // do nothing 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /samples/myoddweb.directorywatcher.load/myoddweb.directorywatcher.load.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | netcoreapp3.1 6 | 7 | 8 | 9 | ..\bin\Debug\ 10 | 11 | 12 | 13 | ..\bin\Release\ 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /samples/myoddweb.directorywatcher.sample/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /samples/myoddweb.directorywatcher.sample/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("myoddweb.directorywatcher.sample")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("myoddweb.directorywatcher.sample")] 13 | [assembly: AssemblyCopyright("Copyright © 2018-2019")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("32a5ef58-410b-41c2-9bde-e709f2105c2b")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("0.1.4.0")] 36 | [assembly: AssemblyFileVersion("0.1.4.0")] 37 | -------------------------------------------------------------------------------- /samples/myoddweb.directorywatcher.sample/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /samples/myoddweb.directorywatcher.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.28010.2036 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "myoddweb.directorywatcher.sample", "myoddweb.directorywatcher.sample\myoddweb.directorywatcher.sample.csproj", "{32A5EF58-410B-41C2-9BDE-E709F2105C2B}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {32A5EF58-410B-41C2-9BDE-E709F2105C2B}.Debug|x64.ActiveCfg = Debug|Any CPU 17 | {32A5EF58-410B-41C2-9BDE-E709F2105C2B}.Debug|x64.Build.0 = Debug|Any CPU 18 | {32A5EF58-410B-41C2-9BDE-E709F2105C2B}.Debug|x86.ActiveCfg = Debug|Any CPU 19 | {32A5EF58-410B-41C2-9BDE-E709F2105C2B}.Debug|x86.Build.0 = Debug|Any CPU 20 | {32A5EF58-410B-41C2-9BDE-E709F2105C2B}.Release|x64.ActiveCfg = Release|Any CPU 21 | {32A5EF58-410B-41C2-9BDE-E709F2105C2B}.Release|x64.Build.0 = Release|Any CPU 22 | {32A5EF58-410B-41C2-9BDE-E709F2105C2B}.Release|x86.ActiveCfg = Release|Any CPU 23 | {32A5EF58-410B-41C2-9BDE-E709F2105C2B}.Release|x86.Build.0 = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {AD978760-A920-4743-A650-80F31A13890C} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /samples/nonblocking/Program.cs: -------------------------------------------------------------------------------- 1 | using myoddweb.directorywatcher; 2 | using myoddweb.directorywatcher.interfaces; 3 | using System; 4 | using System.Threading; 5 | using System.Threading.Tasks; 6 | 7 | namespace nonblocking 8 | { 9 | internal class Program 10 | { 11 | private static readonly IWatcher3 Watcher = new Watcher(); 12 | 13 | private static void Main() 14 | { 15 | Console.WriteLine( Environment.Is64BitProcess ? "64-bit process" : "32-bit process" ); 16 | Console.WriteLine( "Press Ctrl+C to stop the monitors." ); 17 | 18 | // start the monitor. 19 | var drvs = System.IO.DriveInfo.GetDrives(); 20 | foreach (var drv in drvs) 21 | { 22 | if (drv.DriveType == System.IO.DriveType.Fixed) 23 | { 24 | Watcher.Add(new Request(drv.Name, true)); 25 | } 26 | } 27 | 28 | Watcher.OnTouchedAsync += OnTouchedAsync; 29 | 30 | Watcher.Start(); 31 | 32 | WaitForCtrlC(); 33 | 34 | Watcher.Stop(); 35 | } 36 | 37 | private static Task OnTouchedAsync(IFileSystemEvent fse, CancellationToken token) 38 | { 39 | Console.WriteLine($"[{fse.DateTimeUtc:HH:mm:ss.ffff}]:[{fse.FileSystemInfo.FullName}" ); 40 | 41 | var rng = new Random(); 42 | if( rng.Next(100) == 0 ) 43 | { 44 | Console.WriteLine("Calling STOP in loop - Start!"); 45 | Watcher.Stop(); 46 | Console.WriteLine("Calling STOP in loop - End!"); 47 | } 48 | return Task.CompletedTask; 49 | } 50 | 51 | private static void WaitForCtrlC() 52 | { 53 | var exitEvent = new ManualResetEvent(false); 54 | Console.CancelKeyPress += delegate (object sender, ConsoleCancelEventArgs e) 55 | { 56 | e.Cancel = true; 57 | Console.WriteLine("Stop detected."); 58 | exitEvent.Set(); 59 | }; 60 | exitEvent.WaitOne(); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /samples/nonblocking/nonblocking.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | netcoreapp3.0 6 | 7 | 8 | 9 | ..\bin\Debug\ 10 | false 11 | AnyCPU 12 | 13 | 14 | 15 | ..\bin\Release\ 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.interfaces/EventAction.cs: -------------------------------------------------------------------------------- 1 | // Licensed to Florent Guelfucci under one or more agreements. 2 | // Florent Guelfucci licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | namespace myoddweb.directorywatcher.interfaces 5 | { 6 | public enum EventAction 7 | { 8 | /// 9 | /// We have an unknown file event. 10 | /// 11 | Unknown = 1000, 12 | 13 | /// 14 | /// A file/directory was added 15 | /// 16 | Added = 1001, 17 | 18 | /// 19 | /// A file directory was removed 20 | /// 21 | Removed = 1002, 22 | 23 | /// 24 | /// Small changed, timestamp, attribute etc... 25 | /// 26 | Touched = 1003, 27 | 28 | /// 29 | /// A file/directory was renamed. 30 | /// @see IRenamedFileSystemEvent for the old/new name. 31 | /// 32 | Renamed = 1004 33 | } 34 | } -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.interfaces/EventError.cs: -------------------------------------------------------------------------------- 1 | // Licensed to Florent Guelfucci under one or more agreements. 2 | // Florent Guelfucci licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | namespace myoddweb.directorywatcher.interfaces 5 | { 6 | public enum EventError 7 | { 8 | /// 9 | /// General error 10 | /// 11 | None = 0, 12 | 13 | /// 14 | /// General error 15 | /// 16 | General = 1, 17 | 18 | /// 19 | /// General memory error, (out of and so on). 20 | /// 21 | Memory = 2, 22 | 23 | /// 24 | /// there was an overflow. 25 | /// 26 | Overflow = 3, 27 | 28 | /// 29 | /// the monitoring was stopped somehow. 30 | /// 31 | Aborted = 4, 32 | 33 | /// 34 | /// Unable to even start the monitoring 35 | /// Is the path valid? Is the filename valid? 36 | /// 37 | CannotStart = 5, 38 | 39 | /// 40 | /// Cannot access the file/folder 41 | /// 42 | Access = 6, 43 | 44 | /// 45 | /// The event did not have any file data. 46 | /// 47 | NoFileData = 7, 48 | 49 | /// 50 | /// There was an issue trying to stop the watcher(s) 51 | /// 52 | CannotStop = 8 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.interfaces/IEvent.cs: -------------------------------------------------------------------------------- 1 | // Licensed to Florent Guelfucci under one or more agreements. 2 | // Florent Guelfucci licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | using System; 5 | 6 | namespace myoddweb.directorywatcher.interfaces 7 | { 8 | public interface IEvent 9 | { 10 | /// 11 | /// Boolean if the update is a file or a directory. 12 | /// 13 | bool IsFile { get; } 14 | 15 | /// 16 | /// The full path 17 | /// 18 | string Name { get; } 19 | 20 | /// 21 | /// In the case of a rename, this is the old name 22 | /// 23 | string OldName { get; } 24 | 25 | /// 26 | /// The action defining this event. 27 | /// 28 | EventAction Action { get; } 29 | 30 | /// 31 | /// If there was an error with this event 32 | /// EventError.None otherwise 33 | /// 34 | EventError Error { get; } 35 | 36 | /// 37 | /// When the event happened. 38 | /// 39 | DateTime DateTimeUtc { get; } 40 | } 41 | } -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.interfaces/IEventError.cs: -------------------------------------------------------------------------------- 1 | // Licensed to Florent Guelfucci under one or more agreements. 2 | // Florent Guelfucci licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | using System; 5 | 6 | namespace myoddweb.directorywatcher.interfaces 7 | { 8 | public interface IEventError 9 | { 10 | /// 11 | /// The error code. 12 | /// 13 | EventError Code { get; } 14 | 15 | /// 16 | /// The error message 17 | /// 18 | string Message { get; } 19 | 20 | /// 21 | /// The UTC date time. 22 | /// 23 | DateTime DateTimeUtc { get; } 24 | } 25 | } -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.interfaces/IFileSystemEvent.cs: -------------------------------------------------------------------------------- 1 | // Licensed to Florent Guelfucci under one or more agreements. 2 | // Florent Guelfucci licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | using System; 5 | using System.IO; 6 | 7 | namespace myoddweb.directorywatcher.interfaces 8 | { 9 | public interface IFileSystemEvent 10 | { 11 | /// 12 | /// The file system event. 13 | /// 14 | FileSystemInfo FileSystemInfo { get; } 15 | 16 | /// 17 | /// Gets the full path of the directory or file. 18 | /// 19 | /// A string containing the full path. 20 | string FullName { get; } 21 | 22 | /// 23 | /// For files, gets the name of the file. For directories, gets the name of the last 24 | /// directory in the hierarchy if a hierarchy exists. Otherwise, the Name property 25 | /// gets the name of the directory. 26 | /// 27 | /// A string that is the name of the parent directory, the name of the last directory 28 | /// in the hierarchy, or the name of a file, including the file name extension. 29 | /// 30 | string Name { get; } 31 | 32 | /// 33 | /// The Action 34 | /// Added 35 | /// Removed 36 | /// Touched 37 | /// Renamed 38 | /// 39 | EventAction Action { get; } 40 | 41 | /// 42 | /// If there was an error or not. 43 | /// 44 | EventError Error { get; } 45 | 46 | /// 47 | /// The UTC date time of the event. 48 | /// 49 | DateTime DateTimeUtc { get; } 50 | 51 | /// 52 | /// Boolean if the update is a file or a directory. 53 | /// 54 | bool IsFile { get; } 55 | 56 | /// 57 | /// Return if the event is a certain action 58 | /// (same as Action == action) 59 | /// 60 | /// 61 | /// 62 | bool Is(EventAction action ); 63 | } 64 | } -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.interfaces/ILoggerEvent.cs: -------------------------------------------------------------------------------- 1 | namespace myoddweb.directorywatcher.interfaces 2 | { 3 | /// 4 | /// A logger event 5 | /// 6 | public interface ILoggerEvent 7 | { 8 | /// 9 | /// The id of the request 10 | /// 11 | long Id { get; } 12 | 13 | /// 14 | /// The message log level... 15 | /// 16 | LogLevel LogLevel { get; } 17 | 18 | /// 19 | /// The actual message 20 | /// 21 | string Message { get; } 22 | } 23 | } -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.interfaces/IRates.cs: -------------------------------------------------------------------------------- 1 | // Licensed to Florent Guelfucci under one or more agreements. 2 | // Florent Guelfucci licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | namespace myoddweb.directorywatcher.interfaces 5 | { 6 | /// 7 | /// The various rates of refresh 8 | /// 9 | public interface IRates 10 | { 11 | /// 12 | /// How often we would like the libraries posted 13 | /// If the value is -1 then the statistics are not published. 14 | /// 15 | long StatisticsMilliseconds { get; } 16 | 17 | /// 18 | /// How quickly we want to publish events 19 | /// If this value is -1 then events are not published, (but still recorded) 20 | /// 21 | long EventsMilliseconds { get; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.interfaces/IRenamedFileSystemEvent.cs: -------------------------------------------------------------------------------- 1 | // Licensed to Florent Guelfucci under one or more agreements. 2 | // Florent Guelfucci licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | using System.IO; 5 | 6 | namespace myoddweb.directorywatcher.interfaces 7 | { 8 | public interface IRenamedFileSystemEvent : IFileSystemEvent 9 | { 10 | /// 11 | /// The file system event. 12 | /// 13 | FileSystemInfo PreviousFileSystemInfo { get; } 14 | 15 | /// 16 | /// Gets the full path of the directory or file. 17 | /// 18 | /// A string containing the full path. 19 | string PreviousFullName { get; } 20 | 21 | /// 22 | /// For files, gets the name of the file. For directories, gets the name of the last 23 | /// directory in the hierarchy if a hierarchy exists. Otherwise, the Name property 24 | /// gets the name of the directory. 25 | /// 26 | /// A string that is the name of the parent directory, the name of the last directory 27 | /// in the hierarchy, or the name of a file, including the file name extension. 28 | /// 29 | string PreviousName { get; } 30 | } 31 | } -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.interfaces/IRequest.cs: -------------------------------------------------------------------------------- 1 | // Licensed to Florent Guelfucci under one or more agreements. 2 | // Florent Guelfucci licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | namespace myoddweb.directorywatcher.interfaces 5 | { 6 | public interface IRequest 7 | { 8 | /// 9 | /// The path we are watching 10 | /// 11 | string Path { get; } 12 | 13 | /// 14 | /// If it is recursive or not. 15 | /// 16 | bool Recursive { get; } 17 | 18 | /// 19 | /// The various refresh rates 20 | /// 21 | IRates Rates { get; } 22 | } 23 | } -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.interfaces/IStatistics.cs: -------------------------------------------------------------------------------- 1 | namespace myoddweb.directorywatcher.interfaces 2 | { 3 | public interface IStatistics 4 | { 5 | /// 6 | /// The watched id 7 | /// 8 | long Id { get; } 9 | 10 | /// 11 | /// The elapsed time since the last time we received a message 12 | /// 13 | double ElapsedTime { get; } 14 | 15 | /// 16 | /// The total number of events since the last stats call. 17 | /// 18 | long NumberOfEvents { get; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.interfaces/IWatcher1.cs: -------------------------------------------------------------------------------- 1 | // Licensed to Florent Guelfucci under one or more agreements. 2 | // Florent Guelfucci licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | using System.Collections.Generic; 5 | 6 | namespace myoddweb.directorywatcher.interfaces 7 | { 8 | public interface IWatcher1 9 | { 10 | /// 11 | /// Start a request and return its id. 12 | /// 13 | /// 14 | /// 15 | long Start(IRequest request ); 16 | 17 | /// 18 | /// Stop and remove a currently running request. 19 | /// 20 | /// 21 | /// 22 | bool Stop(long id ); 23 | 24 | /// 25 | /// Get the event for the given id. 26 | /// 27 | /// The id we are looking for. 28 | /// The events we got. 29 | /// The number of events 30 | long GetEvents(long id, out IList events ); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.interfaces/IWatcher2.cs: -------------------------------------------------------------------------------- 1 | // Licensed to Florent Guelfucci under one or more agreements. 2 | // Florent Guelfucci licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | using System.Collections.Generic; 5 | using System.Threading; 6 | using System.Threading.Tasks; 7 | 8 | namespace myoddweb.directorywatcher.interfaces 9 | { 10 | public delegate Task WatcherEvent(T e, CancellationToken token); 11 | 12 | public interface IWatcher2 : IWatcher1, IWatcherEvents 13 | { 14 | /// 15 | /// Add a request, if monitoring has started already, 16 | /// we will start monitoring right away 17 | /// 18 | /// 19 | /// Success or not. 20 | bool Add(IRequest request); 21 | 22 | /// 23 | /// Start all the requests 24 | /// 25 | /// 26 | bool Start(); 27 | 28 | /// 29 | /// Stop all the running requests. 30 | /// 31 | /// 32 | bool Stop(); 33 | 34 | /// 35 | /// Get all the event for the started ids. 36 | /// 37 | /// The events we got. 38 | /// The number of events 39 | long GetEvents( out IList events); 40 | } 41 | } -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.interfaces/IWatcher3.cs: -------------------------------------------------------------------------------- 1 | // Licensed to Florent Guelfucci under one or more agreements. 2 | // Florent Guelfucci licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace myoddweb.directorywatcher.interfaces 8 | { 9 | public interface IWatcher3 : IWatcher2, IDisposable 10 | { 11 | /// 12 | /// If the watcher is ready or not. 13 | /// 14 | /// 15 | bool Ready(); 16 | 17 | /// 18 | /// Get all the statistics for all the events. 19 | /// 20 | /// Stats we got. 21 | /// The number of statistics 22 | long GetStatistics(out IList statistics); 23 | 24 | /// 25 | /// Get the statistics for a watcher 26 | /// 27 | /// The id we are looking for. 28 | /// Stats we got. 29 | /// If we got the stats or not. 30 | bool GetStatistics(long id, out IStatistics statistics); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.interfaces/IWatcherEvents.cs: -------------------------------------------------------------------------------- 1 | // Licensed to Florent Guelfucci under one or more agreements. 2 | // Florent Guelfucci licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | namespace myoddweb.directorywatcher.interfaces 5 | { 6 | public interface IWatcherEvents 7 | { 8 | /// 9 | /// Event when a FileSystem event was 'touched'. 10 | /// Changed attribute, size changed etc... 11 | /// 12 | event WatcherEvent OnTouchedAsync; 13 | 14 | /// 15 | /// Event when a FileSystem event was added. 16 | /// 17 | event WatcherEvent OnAddedAsync; 18 | 19 | /// 20 | /// Event when a FileSystem event was Removed. 21 | /// 22 | event WatcherEvent OnRemovedAsync; 23 | 24 | /// 25 | /// Event when a FileSystem event was Renamed. 26 | /// 27 | event WatcherEvent OnRenamedAsync; 28 | 29 | /// 30 | /// There was an error. 31 | /// 32 | event WatcherEvent OnErrorAsync; 33 | 34 | /// 35 | /// The statistics of the engine. 36 | /// 37 | event WatcherEvent OnStatisticsAsync; 38 | 39 | /// 40 | /// When we get a log message 41 | /// 42 | event WatcherEvent OnLoggerAsync; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.interfaces/LogLevel.cs: -------------------------------------------------------------------------------- 1 | // Licensed to Florent Guelfucci under one or more agreements. 2 | // Florent Guelfucci licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | namespace myoddweb.directorywatcher.interfaces 5 | { 6 | /// 7 | /// The various log levels. 8 | /// 9 | /// NB: We force the type int to make it clear that the enum is an int 10 | /// This is what the unmanaged class is passing us! 11 | // ReSharper disable once EnumUnderlyingTypeIsInt 12 | public enum LogLevel : int 13 | { 14 | /// 15 | /// We have an unknown log level 16 | /// 17 | Unknown = 0, 18 | 19 | /// 20 | /// Informational message 21 | /// 22 | Information = 1, 23 | 24 | /// 25 | /// This is just a warning, something unimportant happned 26 | /// 27 | Warning = 2, 28 | 29 | /// 30 | /// There was an error that prevented an acction to be completed. 31 | /// 32 | Error = 3, 33 | 34 | /// 35 | /// Something terrible happened! Might cause program to end 36 | /// 37 | Panic = 4, 38 | 39 | /// 40 | /// Only debug messages are included here. 41 | /// 42 | Debug = 100 43 | } 44 | } -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.interfaces/myoddweb.directorywatcher.interfaces.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | A fast and reliable, (non blocking!), .NET File/Directory watcher, complete rewrite of FileSystemWatcher to ensure speed/acuracy/reliability/suppress duplicate events 5 | 0.1.9 6 | net452;net462;netstandard2.0;netcoreapp3.0 7 | 8 | MyOddWeb.DirectoryWatcher.Interfaces 9 | MyOddWeb.DirectoryWatcher.Interfaces 10 | true 11 | ../myoddweb.directorywatcher.snk 12 | 13 | 14 | 15 | $(SolutionDir)bin\Release\ 16 | 17 | 18 | 19 | $(SolutionDir)bin\Debug\ 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | $(DefineConstants);CORECLR 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FFMG/myoddweb.directorywatcher/9a35a2ba3122157f86ab7aa084e8128cfc2148e3/src/myoddweb.directorywatcher.snk -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.test/HelperTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace myoddweb.directorywatcher.test 5 | { 6 | internal class HelperTest : IDisposable 7 | { 8 | public string Folder { get; } 9 | 10 | public HelperTest() 11 | { 12 | Folder = GetTemporaryDirectory(); 13 | } 14 | 15 | private string GetTemporaryDirectory() 16 | { 17 | string tempDirectory = Path.Combine(Path.GetTempPath(), $"test.{Path.GetRandomFileName()}"); 18 | Directory.CreateDirectory(tempDirectory); 19 | return tempDirectory; 20 | } 21 | 22 | public void Dispose() 23 | { 24 | try 25 | { 26 | Directory.Delete(Folder, true ); 27 | } 28 | catch 29 | { 30 | // ignore 31 | } 32 | } 33 | 34 | public void AddFile() 35 | { 36 | string tempFile = Path.Combine(Folder, Path.GetRandomFileName()); 37 | using (File.Create(tempFile)) { }; 38 | } 39 | 40 | public string AddFolder() 41 | { 42 | string tempDirectory = Path.Combine(Folder, $"test.sub.{Path.GetRandomFileName()}"); 43 | Directory.CreateDirectory(tempDirectory); 44 | return tempDirectory; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.test/LoggerEventTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using myoddweb.directorywatcher.interfaces; 3 | using myoddweb.directorywatcher.utils.Helper; 4 | using NUnit.Framework; 5 | 6 | namespace myoddweb.directorywatcher.test 7 | { 8 | [TestFixture] 9 | internal class LoggerEventTest 10 | { 11 | [TestCase(12)] 12 | [TestCase(400)] 13 | [TestCase(long.MaxValue)] 14 | public void IdIsSaved(long id) 15 | { 16 | var loggerEvent = new LoggerEvent(id, LogLevel.Unknown, "Blah"); 17 | Assert.AreEqual( id, loggerEvent.Id ); 18 | } 19 | 20 | [Test] 21 | public void IdCanBeZero() 22 | { 23 | var loggerEvent = new LoggerEvent(0, LogLevel.Unknown, "Blah"); 24 | Assert.AreEqual(0, loggerEvent.Id); 25 | } 26 | 27 | [TestCase( LogLevel.Debug )] 28 | [TestCase(LogLevel.Error)] 29 | [TestCase(LogLevel.Information)] 30 | [TestCase(LogLevel.Panic)] 31 | [TestCase(LogLevel.Unknown)] 32 | [TestCase(LogLevel.Warning)] 33 | public void LogLevelIsSaved( LogLevel ll ) 34 | { 35 | var loggerEvent = new LoggerEvent(42, ll, "Blah"); 36 | Assert.AreEqual(ll, loggerEvent.LogLevel); 37 | } 38 | 39 | [Test] 40 | public void MessageCannotBeNull() 41 | { 42 | Assert.Throws( () => _ = new LoggerEvent(0, LogLevel.Unknown, null)); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.test/RatesTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices.ComTypes; 3 | using NUnit.Framework; 4 | 5 | namespace myoddweb.directorywatcher.test 6 | { 7 | [TestFixture] 8 | internal class RatesTests 9 | { 10 | [TestCase(1000)] 11 | [TestCase(42)] 12 | [TestCase(200)] 13 | public void EventRateIsSaved( long rate ) 14 | { 15 | var rates = new Rates(rate , 200); 16 | Assert.AreEqual( rate, rates.EventsMilliseconds ); 17 | } 18 | 19 | [TestCase(1000)] 20 | [TestCase(42)] 21 | [TestCase(200)] 22 | public void StatisticsRateIsSaved(long rate) 23 | { 24 | var rates = new Rates(1000, rate); 25 | Assert.AreEqual(rate, rates.StatisticsMilliseconds); 26 | } 27 | 28 | [Test] 29 | public void StatisticsDefaultIsZero() 30 | { 31 | var rates = new Rates(1000); 32 | Assert.AreEqual(0, rates.StatisticsMilliseconds); 33 | } 34 | 35 | [Test] 36 | public void EventsRateCannotBeNegative() 37 | { 38 | Assert.Throws( () => _ = new Rates(-1, 1000) ); 39 | } 40 | 41 | [Test] 42 | public void StatisticsRateCannotBeNegative() 43 | { 44 | Assert.Throws(() => _ = new Rates(1000, -1)); 45 | } 46 | 47 | [Test] 48 | public void EventsRateCanBeZero() 49 | { 50 | Assert.DoesNotThrow(() => _ = new Rates(0, 1000)); 51 | } 52 | 53 | [Test] 54 | public void StatisticsRateCanBeZero() 55 | { 56 | Assert.DoesNotThrow(() => _ = new Rates(1000, 0)); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.test/RequestTests.cs: -------------------------------------------------------------------------------- 1 | // Licensed to Florent Guelfucci under one or more agreements. 2 | // Florent Guelfucci licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | using System; 5 | using myoddweb.directorywatcher.interfaces; 6 | using NUnit.Framework; 7 | 8 | namespace myoddweb.directorywatcher.test 9 | { 10 | [TestFixture] 11 | internal class RequestTests 12 | { 13 | [Test] 14 | public void IsCorrectInterface() 15 | { 16 | var request = new Request( "C:\\", false ); 17 | Assert.IsInstanceOf( request ); 18 | } 19 | 20 | [TestCase("c:\\")] 21 | [TestCase("z:\\")] 22 | [TestCase("C:\\")] 23 | [TestCase("c:\\Full\\Path\\")] 24 | [TestCase("c:\\Full\\Path")] 25 | public void PathIsSaved( string path ) 26 | { 27 | var request = new Request( path, false); 28 | Assert.AreEqual(path, request.Path); 29 | } 30 | 31 | [TestCase(true)] 32 | [TestCase(false)] 33 | public void RecursiveIsSaved(bool recursive) 34 | { 35 | var request = new Request("c:\\", recursive); 36 | Assert.AreEqual(recursive, request.Recursive); 37 | } 38 | 39 | [Test] 40 | public void CannotCreateWithNullPath() 41 | { 42 | Assert.Throws(() => 43 | { 44 | var _ = new Request(null, false); 45 | }); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.test/myoddweb.directorywatcher.test.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netcoreapp3.0 5 | 6 | false 7 | 8 | true 9 | 10 | true 11 | ../myoddweb.directorywatcher.snk 12 | 13 | 14 | 15 | 16 | ..\bin\Debug\ 17 | 18 | 19 | 20 | ..\bin\Release\ 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.test/utils/WatcherManagerTests.cs: -------------------------------------------------------------------------------- 1 | // Licensed to Florent Guelfucci under one or more agreements. 2 | // Florent Guelfucci licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | using NUnit.Framework; 5 | 6 | namespace myoddweb.directorywatcher.test.utils 7 | { 8 | internal class WatcherManagerTests 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.win.test/CollectorTests.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | 3 | #include "../myoddweb.directorywatcher.win/utils/Collector.h" 4 | #include "../myoddweb.directorywatcher.win/utils/Event.h" 5 | #include "../myoddweb.directorywatcher.win/utils/EventAction.h" 6 | #include "../myoddweb.directorywatcher.win/utils/EventError.h" 7 | 8 | using myoddweb::directorywatcher::Collector; 9 | using myoddweb::directorywatcher::Event; 10 | using myoddweb::directorywatcher::EventError; 11 | using myoddweb::directorywatcher::EventAction; 12 | 13 | constexpr auto MaxCleanupAgeMilliseconds = 100; 14 | 15 | TEST(Collector, EmptyCollectorReturnsNothing) { 16 | 17 | // create new one. 18 | Collector c(MaxCleanupAgeMilliseconds); 19 | 20 | // empty 21 | std::vector events; 22 | c.GetEvents(events); 23 | EXPECT_EQ( 0, events.size() ); 24 | } 25 | 26 | TEST(Collector, PathIsValidWithTwoBackSlash) { 27 | 28 | // create new one. 29 | Collector c(MaxCleanupAgeMilliseconds); 30 | c.Add( EventAction::Added, L"c:\\", L"\\foo\\bar.txt", true, EventError::None); 31 | 32 | // get it. 33 | std::vector events; 34 | c.GetEvents(events); 35 | EXPECT_EQ(1, events.size() ); 36 | 37 | EXPECT_TRUE(wcscmp(L"c:\\foo\\bar.txt", events[0]->Name) == 0); 38 | delete events[0]; 39 | } 40 | 41 | TEST(Collector, PathIsValidWithOneBackSlashOnPath) { 42 | 43 | // create new one. 44 | Collector c(MaxCleanupAgeMilliseconds); 45 | c.Add(EventAction::Added, L"c:\\", L"foo\\bar.txt", true, EventError::None); 46 | 47 | // get it. 48 | std::vector events; 49 | c.GetEvents(events); 50 | EXPECT_EQ(1, events.size() ); 51 | 52 | EXPECT_TRUE(wcscmp(L"c:\\foo\\bar.txt", events[0]->Name) == 0); 53 | delete events[0]; 54 | } 55 | 56 | TEST(Collector, PathIsValidWithOneBackSlashOnFileName) { 57 | 58 | // create new one. 59 | Collector c(MaxCleanupAgeMilliseconds); 60 | c.Add(EventAction::Added, L"c:", L"\\foo\\bar.txt", true, EventError::None ); 61 | 62 | // get it. 63 | std::vector events; 64 | c.GetEvents(events); 65 | EXPECT_EQ(1, events.size() ); 66 | 67 | EXPECT_TRUE(wcscmp(L"c:\\foo\\bar.txt", events[0]->Name)==0); 68 | delete events[0]; 69 | } -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.win.test/MonitorDataTests.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | 3 | #include "../myoddweb.directorywatcher.win/monitors/win/Data.h" 4 | #include "../myoddweb.directorywatcher.win/monitors/WinMonitor.h" 5 | 6 | using myoddweb::directorywatcher::win::Data; 7 | using myoddweb::directorywatcher::WinMonitor; 8 | using myoddweb::directorywatcher::Request; 9 | -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.win.test/MonitorsManagerTestHelper.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "../myoddweb.directorywatcher.win/utils/EventAction.h" 9 | using myoddweb::directorywatcher::EventAction; 10 | 11 | constexpr auto TEST_TIMEOUT = 50; 12 | constexpr auto TEST_TIMEOUT_WAIT = 1000; 13 | 14 | class MonitorsManagerTestHelper; 15 | 16 | MonitorsManagerTestHelper* Get(long long id); 17 | bool Remove(long long id); 18 | bool Add(long long id, MonitorsManagerTestHelper* mng); 19 | 20 | class MonitorsManagerTestHelper final 21 | { 22 | private: 23 | std::wstring _folder; 24 | std::wstring _tmpFolder; 25 | std::vector _files; 26 | std::vector _folders; 27 | int _addedFiles; 28 | int _addedFolders; 29 | int _removedFiles; 30 | int _removedFolders; 31 | 32 | public: 33 | MonitorsManagerTestHelper(); 34 | ~MonitorsManagerTestHelper(); 35 | 36 | MonitorsManagerTestHelper( const MonitorsManagerTestHelper& ) = delete; 37 | const MonitorsManagerTestHelper& operator=(const MonitorsManagerTestHelper&) = delete; 38 | 39 | [[nodiscard]] auto Folder() const -> const wchar_t*; 40 | 41 | void EventAction(EventAction action, bool isFile); 42 | 43 | static void LoggerFunction(long long id, int type, const wchar_t* message); 44 | 45 | [[nodiscard]] auto Added(bool isFile) const -> int; 46 | [[nodiscard]] auto Removed(bool isFile) const -> int; 47 | 48 | [[nodiscard]] auto RemoveFile(const std::wstring& filename) const -> bool; 49 | [[nodiscard]] auto RemoveFolder(const std::wstring& folder) const -> bool; 50 | std::wstring AddFile(); 51 | std::wstring AddFolder(); 52 | 53 | protected: 54 | static std::wstring RandomString(const size_t length); 55 | }; 56 | 57 | inline auto eventFunction = [] 58 | ( 59 | const long long id, 60 | const bool isFile, 61 | const wchar_t* name, 62 | const wchar_t* oldName, 63 | const int action, 64 | const int error, 65 | const long long dateTimeUtc 66 | ) -> void 67 | { 68 | Get(id)->EventAction(static_cast<::EventAction>(action), isFile); 69 | }; 70 | 71 | inline auto loggerFunction = [] 72 | ( 73 | const long long id, 74 | const int type, 75 | const wchar_t* message 76 | ) -> void 77 | { 78 | MonitorsManagerTestHelper::LoggerFunction(id, type, message); 79 | }; -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.win.test/RequestTest.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "../myoddweb.directorywatcher.win/utils/Request.h" 3 | #include "RequestTestHelper.h" 4 | 5 | using myoddweb::directorywatcher::Request; 6 | 7 | TEST(Request, PathIsSaved) { 8 | { 9 | const auto path = L"c:\\"; 10 | 11 | // use the test request to create the Request 12 | // we make a copy of our helper onto the 'real' request to make sure copy is not broken 13 | const auto r = RequestHelper( 14 | path, 15 | false, 16 | nullptr, 17 | nullptr, 18 | nullptr, 19 | 0, 20 | 0); 21 | 22 | const auto request = ::Request(r); 23 | EXPECT_TRUE(wcscmp(path, request.Path()) == 0); 24 | } 25 | { 26 | const auto path = L"MuchLonger:\\weird\\path"; 27 | 28 | // use the test request to create the Request 29 | // we make a copy of our helper onto the 'real' request to make sure copy is not broken 30 | const auto r = RequestHelper( 31 | path, 32 | false, 33 | nullptr, 34 | nullptr, 35 | nullptr, 36 | 0, 37 | 0); 38 | const auto request = ::Request(r); 39 | EXPECT_TRUE(wcscmp(path, request.Path()) == 0); 40 | } 41 | } 42 | 43 | TEST(Request, RecursiveIsSaved) { 44 | { 45 | // use the test request to create the Request 46 | // we make a copy of our helper onto the 'real' request to make sure copy is not broken 47 | const auto r = RequestHelper( 48 | L"c:\\", 49 | true, 50 | nullptr, 51 | nullptr, 52 | nullptr, 53 | 0, 54 | 0); 55 | const auto request = ::Request(r); 56 | EXPECT_TRUE( request.Recursive() ); 57 | } 58 | { 59 | // use the test request to create the Request 60 | // we make a copy of our helper onto the 'real' request to make sure copy is not broken 61 | const auto r = RequestHelper( 62 | L"c:\\", 63 | false, 64 | nullptr, 65 | nullptr, 66 | nullptr, 67 | 0, 68 | 0); 69 | const auto request = ::Request(r); 70 | EXPECT_FALSE(request.Recursive()); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.win.test/RequestTestHelper.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "pch.h" 3 | 4 | using myoddweb::directorywatcher::Request; 5 | using myoddweb::directorywatcher::EventCallback; 6 | using myoddweb::directorywatcher::StatisticsCallback; 7 | using myoddweb::directorywatcher::LoggerCallback; 8 | 9 | class RequestHelper : public ::Request 10 | { 11 | public: 12 | RequestHelper( 13 | const wchar_t* path, 14 | bool recursive, 15 | const LoggerCallback& loggerCallback, 16 | const EventCallback& eventsCallback, 17 | const StatisticsCallback& statisticsCallback, 18 | long long eventsCallbackRateMs, 19 | long long statisticsCallbackRateMs 20 | ) : Request( 21 | path, 22 | recursive, 23 | loggerCallback, 24 | eventsCallback, 25 | statisticsCallback, 26 | eventsCallbackRateMs, 27 | statisticsCallbackRateMs 28 | ) 29 | { 30 | 31 | } 32 | }; -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.win.test/WorkerHelper.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../myoddweb.directorywatcher.win/utils/Threads/Worker.h" 3 | #include "../myoddweb.directorywatcher.win/utils/Threads/WorkerPool.h" 4 | 5 | using myoddweb::directorywatcher::threads::Worker; 6 | using myoddweb::directorywatcher::threads::WorkerPool; 7 | 8 | class TestWorker : public ::Worker 9 | { 10 | public: 11 | const int _maxUpdate = 0; 12 | int _updateCalled = 0; 13 | int _startCalled = 0; 14 | int _endCalled = 0; 15 | int _stop = 0; 16 | 17 | TestWorker() = delete; 18 | 19 | explicit TestWorker(const int maxUpdate = 5) : 20 | _maxUpdate(maxUpdate) 21 | { 22 | } 23 | 24 | void OnWorkerStop() override { ++_stop; } 25 | virtual bool OnWorkerStart() override 26 | { 27 | ++_startCalled; 28 | return true; 29 | } 30 | void OnWorkerEnd() override 31 | { 32 | ++_endCalled; 33 | } 34 | bool OnWorkerUpdate(float fElapsedTimeMilliseconds) override 35 | { 36 | // we must have started 37 | EXPECT_TRUE(Started()); 38 | if (_stop > 0) 39 | { 40 | return false; 41 | } 42 | return ++_updateCalled < _maxUpdate; 43 | } 44 | }; 45 | 46 | class TestWorkerOnStart : public TestWorker 47 | { 48 | ::Worker& _worker; 49 | ::WorkerPool& _pool; 50 | 51 | public: 52 | TestWorkerOnStart(::WorkerPool& pool, ::Worker& worker, const int maxUpdate = 5) 53 | : TestWorker( maxUpdate ), 54 | _worker( worker ), 55 | _pool( pool) 56 | { 57 | } 58 | 59 | bool OnWorkerStart() override 60 | { 61 | _pool.Add(_worker); 62 | return TestWorker::OnWorkerStart(); 63 | } 64 | }; 65 | -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.win.test/WorkerTest.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "../myoddweb.directorywatcher.win/utils/Threads/Worker.h" 3 | #include "../myoddweb.directorywatcher.win/utils/Wait.h" 4 | #include "WorkerHelper.h" 5 | 6 | TEST(Worker, DefaultValues) 7 | { 8 | { 9 | const auto worker = TestWorker(1); 10 | EXPECT_FALSE(worker.Started() ); 11 | } 12 | { 13 | const auto worker = TestWorker(1); 14 | EXPECT_FALSE(worker.Completed()); 15 | } 16 | } 17 | 18 | TEST(Worker, StopWhatNeverStarted) { 19 | { 20 | auto worker = TestWorker(1); 21 | worker.Stop(); 22 | EXPECT_TRUE(worker.Completed()); 23 | } 24 | } 25 | 26 | TEST(Worker, StopAfterWeHaveStopped) 27 | { 28 | auto worker = TestWorker(1); 29 | 30 | EXPECT_FALSE(worker.Started()); 31 | EXPECT_FALSE(worker.Completed()); 32 | 33 | worker.Execute(); 34 | 35 | // if we are here, we are done. 36 | EXPECT_TRUE(worker.Completed()); 37 | 38 | // and again 39 | worker.Stop(); 40 | EXPECT_TRUE(worker.Completed()); 41 | } 42 | -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.win.test/pch.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // pch.cpp 3 | // Include the standard header and generate the precompiled header. 4 | // 5 | 6 | #include "pch.h" 7 | -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.win.test/pch.h: -------------------------------------------------------------------------------- 1 | // 2 | // pch.h 3 | // Header for standard system include files. 4 | // 5 | 6 | #pragma once 7 | 8 | #include "gtest/gtest.h" 9 | -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.win/monitors/Callbacks.h: -------------------------------------------------------------------------------- 1 | // Licensed to Florent Guelfucci under one or more agreements. 2 | // Florent Guelfucci licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | #pragma once 5 | 6 | namespace myoddweb:: directorywatcher 7 | { 8 | /** 9 | * \brief a log message 10 | * \param id the id of the monitor, (0 if global) 11 | * \param type the message type, (verbose, information, warning etc ...) 12 | * \param message the message itself 13 | */ 14 | typedef void(__stdcall* LoggerCallback)( 15 | long long id, 16 | int type, 17 | const wchar_t* message 18 | ); 19 | 20 | /** 21 | * \brief various statistics 22 | * \param id the monitor id 23 | * \param elapsedTime the number of ms since the last time this was called. 24 | * \param numberOfEvents the number of events since the last time. 25 | */ 26 | typedef void(__stdcall* StatisticsCallback)( 27 | long long id, 28 | double elapsedTime, 29 | long long numberOfEvents 30 | ); 31 | 32 | /** 33 | * \brief the callback function when an event is raised. 34 | * \param id the monitor id 35 | * \param isFile if the event is for a file or not. 36 | * \param name the name of the file 37 | * \param oldName the previous name of the file, (if needed) 38 | * \param action the action that happened 39 | * \param error the error type, (if any) 40 | * \param dateTimeUtc unix timestamp of the event 41 | */ 42 | typedef void(__stdcall *EventCallback)( 43 | long long id, 44 | bool isFile, 45 | const wchar_t* name, 46 | const wchar_t* oldName, 47 | int action, 48 | int error, 49 | long long dateTimeUtc 50 | ); 51 | } -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.win/monitors/win/Directories.cpp: -------------------------------------------------------------------------------- 1 | // Licensed to Florent Guelfucci under one or more agreements. 2 | // Florent Guelfucci licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | #include 5 | #include "Directories.h" 6 | 7 | namespace myoddweb:: directorywatcher:: win 8 | { 9 | /** 10 | * \brief Create the Monitor that uses ReadDirectoryChanges 11 | */ 12 | Directories::Directories(Monitor& parent, const unsigned long bufferLength) : 13 | Common(parent, bufferLength) 14 | { 15 | } 16 | 17 | /** 18 | * Get the notification filter. 19 | * \return the notification filter 20 | */ 21 | unsigned long Directories::GetNotifyFilter() const 22 | { 23 | // what we are looking for. 24 | // https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-findfirstchangenotificationa 25 | // https://docs.microsoft.com/en-gb/windows/desktop/api/WinBase/nf-winbase-readdirectorychangesw 26 | return 27 | // Any directory-name change in the watched directory or subtree causes a change 28 | // notification wait operation to return. 29 | // Changes include creating or deleting a directory 30 | FILE_NOTIFY_CHANGE_DIR_NAME 31 | ; 32 | } 33 | 34 | /** 35 | * \brief check if a given string is a file or a directory. 36 | * \param action the action we are looking at 37 | * \param path the file we are checking. 38 | * \return if the string given is a file or not. 39 | */ 40 | bool Directories::IsFile(const EventAction action, const std::wstring& path) const 41 | { 42 | // we are the directory monitor 43 | // so it can never be a file. 44 | return false; 45 | } 46 | } -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.win/monitors/win/Directories.h: -------------------------------------------------------------------------------- 1 | // Licensed to Florent Guelfucci under one or more agreements. 2 | // Florent Guelfucci licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | #pragma once 5 | #include "Common.h" 6 | #include "../../utils/EventAction.h" 7 | 8 | namespace myoddweb 9 | { 10 | namespace directorywatcher 11 | { 12 | namespace win 13 | { 14 | class Directories final : public Common 15 | { 16 | public: 17 | Directories(Monitor& parent, unsigned long bufferLength); 18 | virtual ~Directories() = default; 19 | 20 | Directories(const Directories&) = delete; 21 | Directories(Directories&&) = delete; 22 | Directories& operator=(const Directories&) = delete; 23 | Directories& operator=(Directories&&) = delete; 24 | 25 | protected: 26 | /** 27 | * Get the notification filter. 28 | * \return the notification filter 29 | */ 30 | [[nodiscard]] 31 | unsigned long GetNotifyFilter() const override; 32 | 33 | /** 34 | * \brief check if a given string is a file or a directory. 35 | * \param action the action we are looking at 36 | * \param path the file we are checking. 37 | * \return if the string given is a file or not. 38 | */ 39 | [[nodiscard]] 40 | bool IsFile(EventAction action, const std::wstring& path) const override; 41 | }; 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.win/monitors/win/Files.h: -------------------------------------------------------------------------------- 1 | // Licensed to Florent Guelfucci under one or more agreements. 2 | // Florent Guelfucci licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | #pragma once 5 | #include "../Monitor.h" 6 | #include "Common.h" 7 | #include "../../utils/EventAction.h" 8 | 9 | namespace myoddweb 10 | { 11 | namespace directorywatcher 12 | { 13 | namespace win 14 | { 15 | class Files final : public Common 16 | { 17 | public: 18 | Files( Monitor& parent, unsigned long bufferLength); 19 | virtual ~Files() = default; 20 | 21 | Files(const Files&) = delete; 22 | Files(Files&&) = delete; 23 | Files& operator=(const Files&) = delete; 24 | Files& operator=(Files&&) = delete; 25 | 26 | protected: 27 | /** 28 | * Get the notification filter. 29 | * \return the notification filter 30 | */ 31 | [[nodiscard]] 32 | unsigned long GetNotifyFilter() const override; 33 | 34 | /** 35 | * \brief check if a given string is a file or a directory. 36 | * \param action the action we are looking at 37 | * \param path the file we are checking. 38 | * \return if the string given is a file or not. 39 | */ 40 | [[nodiscard]] 41 | bool IsFile(EventAction action, const std::wstring& path) const override; 42 | }; 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.win/myoddweb.directorywatcher.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | 10 | 11 | src 12 | 13 | 14 | src 15 | 16 | 17 | src 18 | 19 | 20 | 21 | 22 | src 23 | 24 | 25 | src 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.win/myoddweb.directorywatcher.win.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FFMG/myoddweb.directorywatcher/9a35a2ba3122157f86ab7aa084e8128cfc2148e3/src/myoddweb.directorywatcher.win/myoddweb.directorywatcher.win.rc -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.win/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by myoddweb.directorywatcher.win.x64.rc 4 | 5 | // Next default values for new objects 6 | // 7 | #ifdef APSTUDIO_INVOKED 8 | #ifndef APSTUDIO_READONLY_SYMBOLS 9 | #define _APS_NEXT_RESOURCE_VALUE 101 10 | #define _APS_NEXT_COMMAND_VALUE 40001 11 | #define _APS_NEXT_CONTROL_VALUE 1001 12 | #define _APS_NEXT_SYMED_VALUE 101 13 | #endif 14 | #endif 15 | -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.win/stdafx.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FFMG/myoddweb.directorywatcher/9a35a2ba3122157f86ab7aa084e8128cfc2148e3/src/myoddweb.directorywatcher.win/stdafx.cpp -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.win/stdafx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FFMG/myoddweb.directorywatcher/9a35a2ba3122157f86ab7aa084e8128cfc2148e3/src/myoddweb.directorywatcher.win/stdafx.h -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.win/targetver.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FFMG/myoddweb.directorywatcher/9a35a2ba3122157f86ab7aa084e8128cfc2148e3/src/myoddweb.directorywatcher.win/targetver.h -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.win/utils/EventAction.h: -------------------------------------------------------------------------------- 1 | // Licensed to Florent Guelfucci under one or more agreements. 2 | // Florent Guelfucci licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | #pragma once 5 | 6 | namespace myoddweb 7 | { 8 | namespace directorywatcher 9 | { 10 | enum class EventAction 11 | { 12 | /// 13 | /// We have an unknown file event. 14 | /// 15 | Unknown = 1000, 16 | 17 | /// 18 | /// A file folder was added. 19 | /// 20 | Added = 1001, 21 | 22 | /// 23 | /// A file folder was removed 24 | /// 25 | Removed = 1002, 26 | 27 | /// 28 | /// Small changed, timestamp, attribute etc... 29 | /// 30 | Touched = 1003, 31 | 32 | /// 33 | /// A file folder was renamed. 34 | /// 35 | Renamed = 1004 36 | }; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.win/utils/EventError.h: -------------------------------------------------------------------------------- 1 | // Licensed to Florent Guelfucci under one or more agreements. 2 | // Florent Guelfucci licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | #pragma once 5 | namespace myoddweb 6 | { 7 | namespace directorywatcher 8 | { 9 | enum class EventError 10 | { 11 | /** 12 | * \brief No error 13 | */ 14 | None = 0, 15 | 16 | /** 17 | * \brief General error 18 | */ 19 | General = 1, 20 | 21 | /** 22 | * \brief General memory error, (out of and so on). 23 | */ 24 | Memory = 2, 25 | 26 | /** 27 | * \brief there was an overflow. 28 | */ 29 | Overflow = 3, 30 | 31 | /** 32 | * \brief the monitoring was stopped somehow. 33 | */ 34 | Aborted = 4, 35 | 36 | /** 37 | * \brief Unable to even start the monitoring 38 | * Is the path valid? Is the filename valid? 39 | */ 40 | CannotStart = 5, 41 | 42 | /** 43 | * \brief Cannot access the file/folder 44 | */ 45 | Access = 6, 46 | 47 | /** 48 | * \brief We did not have any file data 49 | */ 50 | NoFileData = 7, 51 | 52 | /** 53 | * \brief We could not stop the monitor? 54 | */ 55 | CannotStop = 8, 56 | }; 57 | } 58 | } -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.win/utils/Io.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | namespace myoddweb 6 | { 7 | namespace directorywatcher 8 | { 9 | class Io final 10 | { 11 | public: 12 | Io(const Io&) = delete; 13 | Io& operator=(const Io&) = delete; 14 | 15 | private: 16 | Io() = default; 17 | ~Io() = default; 18 | 19 | public: 20 | /** 21 | * \brief combine 2 paths together making sure that the path is valid. 22 | * If both values are empty we return empty string 23 | * We assume that the lhs is a path and never a file, so we will add '\', (or '/' on *nix machines) 24 | * \param lhs the left hand side of the path 25 | * \param rhs the right hand side of the path 26 | * \return the combined path 27 | */ 28 | static std::wstring Combine(const std::wstring& lhs, const std::wstring& rhs); 29 | 30 | /** 31 | * \brief check if a given string is a file or a directory. 32 | * \param path the file we are checking. 33 | * \return if the string given is a file or not. 34 | */ 35 | static bool IsFile( const std::wstring& path); 36 | 37 | /** 38 | * \brief Check if a given directory is a dot or double dot 39 | * \param directory the lhs folder. 40 | * \return if it is a dot directory or not 41 | */ 42 | static bool IsDot(const std::wstring& directory); 43 | 44 | /** 45 | * \brief Get all the sub folders of a given folder. 46 | * \param folder the starting folder. 47 | * \return all the sub-folders, (if any). 48 | */ 49 | static std::vector GetAllSubFolders(const std::wstring& folder); 50 | 51 | /** 52 | * \brief Compare if 2 folders are the same 53 | * \param lhs the first folder 54 | * \param rhs the second folder 55 | * \return if both folders are similar. 56 | */ 57 | static bool AreSameFolders(const std::wstring& lhs, const std::wstring& rhs); 58 | }; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.win/utils/Lock.cpp: -------------------------------------------------------------------------------- 1 | // Licensed to Florent Guelfucci under one or more agreements. 2 | // Florent Guelfucci licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | #include "Lock.h" 5 | 6 | namespace myoddweb:: directorywatcher 7 | { 8 | // grab the lock 9 | Lock::Lock(MYODDWEB_MUTEX& lock) : _lock(lock) 10 | { 11 | _lock.lock(); 12 | } 13 | 14 | // release the lock 15 | Lock::~Lock() 16 | { 17 | _lock.unlock(); 18 | } 19 | } -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.win/utils/LogLevel.h: -------------------------------------------------------------------------------- 1 | // Licensed to Florent Guelfucci under one or more agreements. 2 | // Florent Guelfucci licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | #pragma once 5 | 6 | namespace myoddweb:: directorywatcher 7 | { 8 | /// 9 | /// The different log levels 10 | /// 11 | enum class LogLevel : int 12 | { 13 | /// 14 | /// We have an unknown log leve 15 | /// 16 | Unknown = 0, 17 | 18 | /// 19 | /// Informational message 20 | /// 21 | Information = 1, 22 | 23 | /// 24 | /// This is just a warning, something unimportant happned 25 | /// 26 | Warning = 2, 27 | 28 | /// 29 | /// There was an error that prevented an acction to be completed. 30 | /// 31 | Error = 3, 32 | 33 | /// 34 | /// Something terrible happened! Might cause program to end 35 | /// 36 | Panic = 4, 37 | 38 | /// 39 | /// Only debug messages are included here. 40 | /// 41 | Debug = 100 42 | }; 43 | } 44 | -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.win/utils/Threads/CallbackWorker.cpp: -------------------------------------------------------------------------------- 1 | // Licensed to Florent Guelfucci under one or more agreements. 2 | // Florent Guelfucci licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | #include "CallbackWorker.h" 5 | #include 6 | 7 | #include "../Instrumentor.h" 8 | 9 | namespace myoddweb::directorywatcher::threads 10 | { 11 | CallbackWorker::CallbackWorker(TCallback function) : 12 | Worker(), 13 | _function(std::move(function)) 14 | { 15 | } 16 | 17 | bool CallbackWorker::OnWorkerUpdate(float fElapsedTimeMilliseconds) 18 | { 19 | MYODDWEB_PROFILE_FUNCTION(); 20 | 21 | // call the function 22 | _function(); 23 | 24 | // we are done. 25 | return false; 26 | } 27 | 28 | /** 29 | * \brief called when the worker has completed 30 | * this is to allow our workers a chance to dispose of data 31 | * 32 | */ 33 | void CallbackWorker::OnWorkerEnd() 34 | { 35 | MYODDWEB_PROFILE_FUNCTION(); 36 | } 37 | 38 | /** 39 | * \brief called when the worker has completed 40 | * this is to allow our workers a chance to dispose of data 41 | * 42 | */ 43 | void CallbackWorker::OnWorkerStop() 44 | { 45 | MYODDWEB_PROFILE_FUNCTION(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.win/utils/Threads/CallbackWorker.h: -------------------------------------------------------------------------------- 1 | // Licensed to Florent Guelfucci under one or more agreements. 2 | // Florent Guelfucci licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | #pragma once 5 | #include "Worker.h" 6 | #include "Thread.h" 7 | 8 | namespace myoddweb:: directorywatcher:: threads 9 | { 10 | /** 11 | * \brief class to run a function via a worker 12 | */ 13 | class CallbackWorker final : public Worker 14 | { 15 | TCallback _function; 16 | public: 17 | explicit CallbackWorker(TCallback function); 18 | virtual ~CallbackWorker() = default; 19 | 20 | CallbackWorker(const CallbackWorker&) = delete; 21 | CallbackWorker(CallbackWorker&&) = delete; 22 | CallbackWorker&& operator=(CallbackWorker&&) = delete; 23 | const CallbackWorker& operator=(const CallbackWorker&) = delete; 24 | 25 | protected: 26 | /** 27 | * \brief called when the worker is ready to start 28 | * return false if you do not wish to start the worker. 29 | */ 30 | bool OnWorkerStart() override { return true; } 31 | 32 | /** 33 | * \brief Give the worker a chance to do something in the loop 34 | * Workers can do _all_ the work at once and simply return false 35 | * or if they have a tight look they can return true until they need to come out. 36 | * \param fElapsedTimeMilliseconds the amount of time since the last time we made this call. 37 | * \return true if we want to continue or false if we want to end the thread 38 | */ 39 | bool OnWorkerUpdate(float fElapsedTimeMilliseconds) override; 40 | 41 | /** 42 | * \brief called when the worker has completed 43 | * this is to allow our workers a chance to dispose of data 44 | */ 45 | void OnWorkerEnd() override; 46 | 47 | /** 48 | * \brief called when stop is called. 49 | * this is to allow our derived workers to stop 50 | */ 51 | void OnWorkerStop() override; 52 | }; 53 | } -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.win/utils/Threads/WaitResult.h: -------------------------------------------------------------------------------- 1 | // Licensed to Florent Guelfucci under one or more agreements. 2 | // Florent Guelfucci licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | #pragma once 5 | 6 | namespace myoddweb 7 | { 8 | namespace directorywatcher 9 | { 10 | namespace threads 11 | { 12 | enum class WaitResult 13 | { 14 | // names for timed wait function returns 15 | complete, 16 | timeout, 17 | }; 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.win/utils/Threads/WorkerId.cpp: -------------------------------------------------------------------------------- 1 | #include "WorkerId.h" 2 | #include "../Lock.h" 3 | 4 | WorkerId::WorkerId() : 5 | _id(1) // we do not wan the number to be zero because 6 | // that id is used as the 'debug' number 7 | { 8 | } 9 | 10 | /// 11 | /// Get the next available id. 12 | /// 13 | /// 14 | long long WorkerId::NextId() 15 | { 16 | static WorkerId workerId; 17 | return workerId.GetNextId(); 18 | } 19 | 20 | /// 21 | /// Get the next id. 22 | /// 23 | /// 24 | long long WorkerId::GetNextId() 25 | { 26 | MYODDWEB_LOCK(_idLock); 27 | return _id++; 28 | } 29 | -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.win/utils/Threads/WorkerId.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../monitors/Base.h" 3 | 4 | class WorkerId final 5 | { 6 | public: 7 | /// 8 | /// Get the next available id. 9 | /// 10 | /// 11 | static long long NextId(); 12 | 13 | private: 14 | WorkerId(); 15 | 16 | /// 17 | /// The current id number 18 | /// 19 | long long _id; 20 | 21 | /// 22 | /// The id lock 23 | /// 24 | MYODDWEB_MUTEX _idLock; 25 | 26 | /// 27 | /// Get the next id. 28 | /// 29 | /// 30 | long long GetNextId(); 31 | }; 32 | 33 | -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.win/watcher.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FFMG/myoddweb.directorywatcher/9a35a2ba3122157f86ab7aa084e8128cfc2148e3/src/myoddweb.directorywatcher.win/watcher.cpp -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher.win/watcher.h: -------------------------------------------------------------------------------- 1 | // Licensed to Florent Guelfucci under one or more agreements. 2 | // Florent Guelfucci licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | #pragma once 5 | #include "monitors/Callbacks.h" 6 | 7 | namespace myoddweb:: directorywatcher 8 | { 9 | /** 10 | * NB: THE ORDER OF THE VARIABLES IS IMPORTANT! 11 | * As set in the Delegates.cs file 12 | * public struct Request 13 | * { 14 | * ... 15 | * } 16 | */ 17 | extern "C" { 18 | struct sRequest 19 | { 20 | /** 21 | * \brief the path of the folder we will be monitoring 22 | */ 23 | wchar_t* Path; 24 | 25 | /** 26 | * \brief if we are recursively monitoring or not. 27 | */ 28 | bool Recursive; 29 | 30 | /** 31 | * \brief the callback even we want to call from time to time. 32 | */ 33 | EventCallback EventsCallback; 34 | 35 | /** 36 | * \brief the callback even we want to call from time to time. 37 | */ 38 | StatisticsCallback StatisticsCallback; 39 | 40 | /** 41 | * How often we wish to callback events 42 | */ 43 | long long EventsCallbackRateMs; 44 | 45 | /** 46 | * How often we wish to callback stats 47 | */ 48 | long long StatisticsCallbackRateMs; 49 | 50 | /** 51 | * \brief the logger callback 52 | */ 53 | LoggerCallback LoggerCallback; 54 | }; 55 | } 56 | 57 | /** 58 | */ 59 | extern "C" { __declspec(dllexport) bool SetConfig(const sRequest& request); } 60 | 61 | /** 62 | * \brief Start watching a folder 63 | * \param request The request containing info about the item we are watching. 64 | * \return The id of the created request or -ve otherwise 65 | */ 66 | extern "C" { __declspec(dllexport) long long Start(const sRequest& request); } 67 | 68 | /** 69 | * \brief stop watching 70 | * \param id the id we would like to remove. 71 | * \return success or not 72 | */ 73 | extern "C" { __declspec(dllexport) bool Stop(long long id); } 74 | 75 | /** 76 | * \brief If the monitor manager is ready or not. 77 | * \return if it is ready or not. 78 | */ 79 | extern "C" { __declspec(dllexport) bool Ready(); } 80 | } -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher/Rates.cs: -------------------------------------------------------------------------------- 1 | // Licensed to Florent Guelfucci under one or more agreements. 2 | // Florent Guelfucci licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | using System; 5 | using myoddweb.directorywatcher.interfaces; 6 | 7 | namespace myoddweb.directorywatcher 8 | { 9 | public class Rates : IRates 10 | { 11 | /// 12 | public long StatisticsMilliseconds { get; } 13 | 14 | /// 15 | public long EventsMilliseconds { get; } 16 | 17 | public Rates(long eventsMilliseconds, long statisticsMilliseconds = 0) 18 | { 19 | if (statisticsMilliseconds < 0) 20 | { 21 | throw new ArgumentException( "The statistics rate cannot be -ve", nameof(statisticsMilliseconds)); 22 | } 23 | if (eventsMilliseconds < 0) 24 | { 25 | throw new ArgumentException("The events rate cannot be -ve", nameof(eventsMilliseconds)); 26 | } 27 | StatisticsMilliseconds = statisticsMilliseconds; 28 | EventsMilliseconds = eventsMilliseconds; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher/Request.cs: -------------------------------------------------------------------------------- 1 | // Licensed to Florent Guelfucci under one or more agreements. 2 | // Florent Guelfucci licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | using System; 5 | using myoddweb.directorywatcher.interfaces; 6 | 7 | namespace myoddweb.directorywatcher 8 | { 9 | public class Request : IRequest 10 | { 11 | /// 12 | public string Path { get; } 13 | 14 | /// 15 | public bool Recursive { get; } 16 | 17 | /// 18 | public IRates Rates { get; } 19 | 20 | /// 21 | /// Create the default requests 22 | /// 23 | /// The path we want to watch 24 | /// Recursively watch or not. 25 | public Request(string path, bool recursive) : 26 | this( path, recursive, new Rates( 50, 0 )) 27 | { 28 | } 29 | 30 | /// 31 | /// Create the default requests 32 | /// 33 | /// The path we want to watch 34 | /// Recursively watch or not. 35 | /// The various refresh rates 36 | public Request(string path, bool recursive, IRates rates ) 37 | { 38 | Path = path ?? throw new ArgumentNullException(nameof(path)); 39 | Recursive = recursive; 40 | Rates = rates ?? throw new ArgumentNullException(nameof(rates)); 41 | } 42 | 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher/myoddweb.directorywatcher.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | A fast and reliable, (non blocking!), .NET File/Directory watcher, complete rewrite of FileSystemWatcher to ensure speed/acuracy/reliability/suppress duplicate events 5 | 0.1.9 6 | net452;net462;netstandard2.0;netcoreapp3.0 7 | 8 | MyOddWeb.DirectoryWatcher 9 | MyOddWeb.DirectoryWatcher 10 | true 11 | ../myoddweb.directorywatcher.snk 12 | 13 | 14 | 15 | $(SolutionDir)bin\Release\ 16 | 17 | 18 | 19 | $(SolutionDir)bin\Debug\ 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | $(DefineConstants);MYODDWEB_NETSTANDARD 35 | 36 | 37 | 38 | $(DefineConstants);MYODDWEB_NETCOREAPP 39 | 40 | 41 | 42 | 43 | x86.directorywatcher.win 44 | 45 | 46 | x64.directorywatcher.win 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher/utils/Helper/Delegates.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace myoddweb.directorywatcher.utils.Helper 4 | { 5 | internal class Delegates 6 | { 7 | public struct Request 8 | { 9 | [MarshalAs(UnmanagedType.LPWStr)] 10 | public string Path; 11 | 12 | [MarshalAs(UnmanagedType.I1)] 13 | public bool Recursive; 14 | 15 | public EventsCallback EventsCallback; 16 | 17 | public StatisticsCallback StatisticsCallback; 18 | 19 | [MarshalAs(UnmanagedType.I8)] 20 | public long EventsCallbackIntervalMs; 21 | 22 | [MarshalAs(UnmanagedType.I8)] 23 | public long StatisticsCallbackIntervalMs; 24 | 25 | public LoggerCallback LoggerCallback; 26 | } 27 | 28 | // Delegate with function signature for the GetVersion function 29 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 30 | [return: MarshalAs(UnmanagedType.I8)] 31 | public delegate long Start(ref Request request); 32 | 33 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 34 | [return: MarshalAs(UnmanagedType.Bool)] 35 | public delegate bool Stop([In, MarshalAs(UnmanagedType.U8)] long id); 36 | 37 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 38 | [return: MarshalAs(UnmanagedType.Bool)] 39 | public delegate bool Ready(); 40 | 41 | [UnmanagedFunctionPointer(CallingConvention.StdCall)] 42 | public delegate void EventsCallback( 43 | [MarshalAs(UnmanagedType.I8)] long id, 44 | [MarshalAs(UnmanagedType.Bool)] bool isFile, 45 | [MarshalAs(UnmanagedType.LPWStr)] string name, 46 | [MarshalAs(UnmanagedType.LPWStr)] string oldName, 47 | [MarshalAs(UnmanagedType.I4)] int action, 48 | [MarshalAs(UnmanagedType.I4)] int error, 49 | [MarshalAs(UnmanagedType.I8)] long dateTimeUtc 50 | ); 51 | 52 | [UnmanagedFunctionPointer(CallingConvention.StdCall)] 53 | public delegate void StatisticsCallback( 54 | [MarshalAs(UnmanagedType.I8)] long id, 55 | [MarshalAs(UnmanagedType.R8)] double elapsedTime, 56 | [MarshalAs(UnmanagedType.I8)] long numberOfEvents 57 | ); 58 | 59 | [UnmanagedFunctionPointer(CallingConvention.StdCall)] 60 | public delegate void LoggerCallback( 61 | [MarshalAs(UnmanagedType.I8)] long id, 62 | [MarshalAs(UnmanagedType.I4)] int type, 63 | [MarshalAs(UnmanagedType.LPWStr)] string message 64 | ); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher/utils/Helper/Event.cs: -------------------------------------------------------------------------------- 1 | using myoddweb.directorywatcher.interfaces; 2 | using System; 3 | 4 | namespace myoddweb.directorywatcher.utils.Helper 5 | { 6 | internal class Event : IEvent 7 | { 8 | public bool IsFile { get; } 9 | 10 | public string Name { get; } 11 | 12 | public string OldName { get; } 13 | 14 | public EventAction Action { get; } 15 | 16 | public interfaces.EventError Error { get; } 17 | 18 | public DateTime DateTimeUtc { get; } 19 | 20 | public Event(bool isFile, 21 | string name, 22 | string oldName, 23 | EventAction action, 24 | interfaces.EventError error, 25 | DateTime dateTimeUtc 26 | ) 27 | { 28 | IsFile = isFile; 29 | Name = name; 30 | OldName = oldName; 31 | Action = action; 32 | Error = error; 33 | DateTimeUtc = dateTimeUtc; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher/utils/Helper/FileSystemEvent.cs: -------------------------------------------------------------------------------- 1 | // Licensed to Florent Guelfucci under one or more agreements. 2 | // Florent Guelfucci licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using System.IO; 7 | using myoddweb.directorywatcher.interfaces; 8 | 9 | namespace myoddweb.directorywatcher.utils.Helper 10 | { 11 | /// 12 | internal class FileSystemEvent : IFileSystemEvent 13 | { 14 | /// 15 | public FileSystemInfo FileSystemInfo { get; } 16 | 17 | /// 18 | public EventAction Action { get; } 19 | 20 | /// 21 | public interfaces.EventError Error { get; } 22 | 23 | /// 24 | public DateTime DateTimeUtc { get; } 25 | 26 | /// 27 | public bool IsFile => FileSystemInfo is FileInfo; 28 | 29 | /// 30 | public string FullName => FileSystemInfo?.FullName ?? "???"; 31 | 32 | /// 33 | public string Name => FileSystemInfo?.Name ?? "???"; 34 | 35 | public FileSystemEvent( IEvent e ) 36 | { 37 | Action = e.Action; 38 | Error = e.Error; 39 | if (e.IsFile) 40 | { 41 | FileSystemInfo = new FileInfo(e.Name); 42 | } 43 | else 44 | { 45 | FileSystemInfo = new DirectoryInfo(e.Name); 46 | } 47 | DateTimeUtc = e.DateTimeUtc; 48 | } 49 | 50 | /// 51 | public bool Is(EventAction action) 52 | { 53 | return Action == action; 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher/utils/Helper/LoggerEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using myoddweb.directorywatcher.interfaces; 3 | 4 | namespace myoddweb.directorywatcher.utils.Helper 5 | { 6 | internal class LoggerEvent : ILoggerEvent 7 | { 8 | /// 9 | public long Id { get; } 10 | 11 | /// 12 | public LogLevel LogLevel { get; } 13 | 14 | /// 15 | public string Message { get; } 16 | 17 | /// 18 | /// The constructor 19 | /// 20 | /// 21 | /// 22 | /// 23 | public LoggerEvent(long id, LogLevel logLevel, string message) 24 | { 25 | Id = id; 26 | LogLevel = logLevel; 27 | Message = message ?? throw new ArgumentNullException(nameof(message)); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher/utils/Helper/NativeLibrary.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace myoddweb.directorywatcher.utils.Helper 5 | { 6 | internal static class NativeLibrary 7 | { 8 | [DllImport("kernel32.dll")] 9 | public static extern IntPtr LoadLibrary(string dllToLoad); 10 | 11 | [DllImport("kernel32.dll")] 12 | public static extern IntPtr GetProcAddress(IntPtr hModule, string procedureName); 13 | 14 | [DllImport("kernel32.dll")] 15 | public static extern bool FreeLibrary(IntPtr hModule); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher/utils/Helper/RenamedFileSystemEvent.cs: -------------------------------------------------------------------------------- 1 | // Licensed to Florent Guelfucci under one or more agreements. 2 | // Florent Guelfucci licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System.IO; 6 | using myoddweb.directorywatcher.interfaces; 7 | 8 | namespace myoddweb.directorywatcher.utils.Helper 9 | { 10 | /// 11 | internal class RenamedFileSystemEvent : FileSystemEvent, IRenamedFileSystemEvent 12 | { 13 | /// 14 | public FileSystemInfo PreviousFileSystemInfo { get; } 15 | 16 | /// 17 | public string PreviousFullName => PreviousFileSystemInfo?.FullName ?? "???"; 18 | 19 | /// 20 | public string PreviousName => PreviousFileSystemInfo?.Name ?? "???"; 21 | 22 | public RenamedFileSystemEvent(IEvent e) : base(e) 23 | { 24 | PreviousFileSystemInfo = new FileInfo(e.OldName); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher/utils/Helper/Statistics.cs: -------------------------------------------------------------------------------- 1 | using myoddweb.directorywatcher.interfaces; 2 | 3 | namespace myoddweb.directorywatcher.utils.Helper 4 | { 5 | internal class Statistics : IStatistics 6 | { 7 | /// 8 | public long Id { get; } 9 | 10 | /// 11 | public double ElapsedTime { get; } 12 | 13 | /// 14 | public long NumberOfEvents { get; } 15 | 16 | public Statistics( long id, double elapsedTime, long numberOfEvents) 17 | { 18 | Id = id; 19 | ElapsedTime = elapsedTime; 20 | NumberOfEvents = numberOfEvents; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher/utils/TypeLoader.cs: -------------------------------------------------------------------------------- 1 | // Licensed to Florent Guelfucci under one or more agreements. 2 | // Florent Guelfucci licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | using System; 5 | using System.Diagnostics; 6 | using System.IO; 7 | using System.Reflection; 8 | 9 | namespace myoddweb.directorywatcher.utils 10 | { 11 | internal static class TypeLoader 12 | { 13 | public static T LoadTypeFromAssembly(string assemblyFilePath) where T : class 14 | { 15 | var currentDirectory = Directory.GetCurrentDirectory(); 16 | try 17 | { 18 | // set the assembly directory 19 | var fi = new FileInfo(assemblyFilePath); 20 | Directory.SetCurrentDirectory(fi.Directory.FullName); 21 | 22 | // then load the assembly 23 | var assembly = Assembly.LoadFrom(assemblyFilePath); 24 | return LoadTypeFromAssembly(assembly); 25 | } 26 | finally 27 | { 28 | if( currentDirectory != null ) 29 | { 30 | // restore the directory 31 | Directory.SetCurrentDirectory(currentDirectory); 32 | } 33 | } 34 | } 35 | 36 | private static T LoadTypeFromAssembly(Assembly assembly) where T : class 37 | { 38 | var exportedTypes = assembly.GetExportedTypes(); 39 | foreach (var t in exportedTypes) 40 | { 41 | // When coming from different assemblies the types don't match, this is very fragile. 42 | //if( typeof( T ).IsAssignableFrom( t ) ) 43 | if (t.GetInterface(typeof(T).FullName, true) != null) 44 | { 45 | try 46 | { 47 | Debug.WriteLine("Trying to create instance of {0}...", t.FullName); 48 | return assembly.CreateInstance(t.FullName) as T; 49 | } 50 | catch (TargetInvocationException e) 51 | { 52 | if (!(e.InnerException is DllNotFoundException dllNotFoundException)) 53 | { 54 | throw; 55 | 56 | } 57 | Debug.WriteLine("A DllNotFoundException was thrown during the attempt to create a type instance. Are you missing some DLL dependencies?"); 58 | throw dllNotFoundException; 59 | } 60 | } 61 | } 62 | return null; 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/myoddweb.directorywatcher/utils/WatcherManagerEmbeddedLoadLibrary.cs: -------------------------------------------------------------------------------- 1 | using myoddweb.directorywatcher.interfaces; 2 | using myoddweb.directorywatcher.utils.Helper; 3 | using System; 4 | using System.Diagnostics.Contracts; 5 | 6 | namespace myoddweb.directorywatcher.utils 7 | { 8 | internal class WatcherManagerEmbeddedLoadLibrary : WatcherManager 9 | { 10 | #region Member variables 11 | /// 12 | /// The Native dll helper 13 | /// 14 | private readonly WatcherManagerNativeLibrary _helper; 15 | #endregion 16 | 17 | public WatcherManagerEmbeddedLoadLibrary() 18 | { 19 | // Create helper we will throw if the file does not exist. 20 | _helper = new WatcherManagerNativeLibrary(GetFromEmbedded(), EventsCallback, StatisticsCallback, LoggerCallback ); 21 | } 22 | 23 | #region Private Methods 24 | private string GetFromEmbedded() 25 | { 26 | return Environment.Is64BitProcess ? GetFromEmbeddedx64() : GetFromEmbeddedx86(); 27 | } 28 | 29 | private string GetFromEmbeddedx86() 30 | { 31 | Contract.Assert(!Environment.Is64BitProcess); 32 | return CreateResourceFile("x86.directorywatcher.win", "myoddweb.directorywatcher.win.x86.dll"); 33 | } 34 | 35 | private string GetFromEmbeddedx64() 36 | { 37 | Contract.Assert(Environment.Is64BitProcess); 38 | return CreateResourceFile("x64.directorywatcher.win", "myoddweb.directorywatcher.win.x64.dll"); 39 | } 40 | #endregion 41 | 42 | #region Abstract methods 43 | public override long Start(IRequest request) 44 | { 45 | return _helper.Start(request); 46 | } 47 | 48 | public override bool Stop(long id) 49 | { 50 | return _helper.Stop(id); 51 | } 52 | 53 | public override bool Ready() 54 | { 55 | return _helper.Ready(); 56 | } 57 | #endregion 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/.clang-format: -------------------------------------------------------------------------------- 1 | # Run manually to reformat a file: 2 | # clang-format -i --style=file 3 | Language: Cpp 4 | BasedOnStyle: Google 5 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore CI build directory 2 | build/ 3 | xcuserdata 4 | cmake-build-debug/ 5 | .idea/ 6 | bazel-bin 7 | bazel-genfiles 8 | bazel-googletest 9 | bazel-out 10 | bazel-testlogs 11 | # python 12 | *.pyc 13 | 14 | # Visual Studio files 15 | .vs 16 | *.sdf 17 | *.opensdf 18 | *.VC.opendb 19 | *.suo 20 | *.user 21 | _ReSharper.Caches/ 22 | Win32-Debug/ 23 | Win32-Release/ 24 | x64-Debug/ 25 | x64-Release/ 26 | 27 | # Ignore autoconf / automake files 28 | Makefile.in 29 | aclocal.m4 30 | configure 31 | build-aux/ 32 | autom4te.cache/ 33 | googletest/m4/libtool.m4 34 | googletest/m4/ltoptions.m4 35 | googletest/m4/ltsugar.m4 36 | googletest/m4/ltversion.m4 37 | googletest/m4/lt~obsolete.m4 38 | googlemock/m4 39 | 40 | # Ignore generated directories. 41 | googlemock/fused-src/ 42 | googletest/fused-src/ 43 | 44 | # macOS files 45 | .DS_Store 46 | googletest/.DS_Store 47 | googletest/xcode/.DS_Store 48 | 49 | # Ignore cmake generated directories and files. 50 | CMakeFiles 51 | CTestTestfile.cmake 52 | Makefile 53 | cmake_install.cmake 54 | googlemock/CMakeFiles 55 | googlemock/CTestTestfile.cmake 56 | googlemock/Makefile 57 | googlemock/cmake_install.cmake 58 | googlemock/gtest 59 | /bin 60 | /googlemock/gmock.dir 61 | /googlemock/gmock_main.dir 62 | /googlemock/RUN_TESTS.vcxproj.filters 63 | /googlemock/RUN_TESTS.vcxproj 64 | /googlemock/INSTALL.vcxproj.filters 65 | /googlemock/INSTALL.vcxproj 66 | /googlemock/gmock_main.vcxproj.filters 67 | /googlemock/gmock_main.vcxproj 68 | /googlemock/gmock.vcxproj.filters 69 | /googlemock/gmock.vcxproj 70 | /googlemock/gmock.sln 71 | /googlemock/ALL_BUILD.vcxproj.filters 72 | /googlemock/ALL_BUILD.vcxproj 73 | /lib 74 | /Win32 75 | /ZERO_CHECK.vcxproj.filters 76 | /ZERO_CHECK.vcxproj 77 | /RUN_TESTS.vcxproj.filters 78 | /RUN_TESTS.vcxproj 79 | /INSTALL.vcxproj.filters 80 | /INSTALL.vcxproj 81 | /googletest-distribution.sln 82 | /CMakeCache.txt 83 | /ALL_BUILD.vcxproj.filters 84 | /ALL_BUILD.vcxproj 85 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Note: CMake support is community-based. The maintainers do not use CMake 2 | # internally. 3 | 4 | cmake_minimum_required(VERSION 2.8.8) 5 | 6 | if (POLICY CMP0048) 7 | cmake_policy(SET CMP0048 NEW) 8 | endif (POLICY CMP0048) 9 | 10 | project(googletest-distribution) 11 | set(GOOGLETEST_VERSION 1.10.0) 12 | 13 | if (CMAKE_VERSION VERSION_LESS "3.1") 14 | add_definitions(-std=c++11) 15 | else() 16 | set(CMAKE_CXX_STANDARD 11) 17 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 18 | if(NOT CYGWIN) 19 | set(CMAKE_CXX_EXTENSIONS OFF) 20 | endif() 21 | endif() 22 | 23 | enable_testing() 24 | 25 | include(CMakeDependentOption) 26 | include(GNUInstallDirs) 27 | 28 | #Note that googlemock target already builds googletest 29 | option(BUILD_GMOCK "Builds the googlemock subproject" ON) 30 | option(INSTALL_GTEST "Enable installation of googletest. (Projects embedding googletest may want to turn this OFF.)" ON) 31 | 32 | if(BUILD_GMOCK) 33 | add_subdirectory( googlemock ) 34 | else() 35 | add_subdirectory( googletest ) 36 | endif() 37 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/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 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/WORKSPACE: -------------------------------------------------------------------------------- 1 | workspace(name = "com_google_googletest") 2 | 3 | load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") 4 | 5 | # Abseil 6 | http_archive( 7 | name = "com_google_absl", 8 | urls = ["https://github.com/abseil/abseil-cpp/archive/master.zip"], 9 | strip_prefix = "abseil-cpp-master", 10 | ) 11 | 12 | http_archive( 13 | name = "rules_cc", 14 | strip_prefix = "rules_cc-master", 15 | urls = ["https://github.com/bazelbuild/rules_cc/archive/master.zip"], 16 | ) 17 | 18 | http_archive( 19 | name = "rules_python", 20 | strip_prefix = "rules_python-master", 21 | urls = ["https://github.com/bazelbuild/rules_python/archive/master.zip"], 22 | ) 23 | 24 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/ci/build-linux-bazel.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright 2017 Google Inc. 3 | # All Rights Reserved. 4 | # 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 | set -e 33 | 34 | bazel version 35 | bazel build --curses=no //...:all 36 | bazel test --curses=no //...:all 37 | bazel test --curses=no //...:all --define absl=1 38 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/ci/build-platformio.sh: -------------------------------------------------------------------------------- 1 | # run PlatformIO builds 2 | platformio run 3 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/ci/env-linux.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright 2017 Google Inc. 3 | # All Rights Reserved. 4 | # 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 | # 33 | # This file should be sourced, and not executed as a standalone script. 34 | # 35 | 36 | # TODO() - we can check if this is being sourced using $BASH_VERSION and $BASH_SOURCE[0] != ${0}. 37 | 38 | if [ "${TRAVIS_OS_NAME}" = "linux" ]; then 39 | if [ "$CXX" = "g++" ]; then export CXX="g++-4.9" CC="gcc-4.9"; fi 40 | if [ "$CXX" = "clang++" ]; then export CXX="clang++-3.9" CC="clang-3.9"; fi 41 | fi 42 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/ci/env-osx.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright 2017 Google Inc. 3 | # All Rights Reserved. 4 | # 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 | # 33 | # This file should be sourced, and not executed as a standalone script. 34 | # 35 | 36 | # TODO() - we can check if this is being sourced using $BASH_VERSION and $BASH_SOURCE[0] != ${0}. 37 | # 38 | 39 | if [ "${TRAVIS_OS_NAME}" = "osx" ]; then 40 | if [ "$CXX" = "clang++" ]; then 41 | # $PATH needs to be adjusted because the llvm tap doesn't install the 42 | # package to /usr/local/bin, etc, like the gcc tap does. 43 | # See: https://github.com/Homebrew/legacy-homebrew/issues/29733 44 | clang_version=3.9 45 | export PATH="/usr/local/opt/llvm@${clang_version}/bin:$PATH"; 46 | fi 47 | fi 48 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/ci/get-nprocessors.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright 2017 Google Inc. 3 | # All Rights Reserved. 4 | # 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 | # This file is typically sourced by another script. 33 | # if possible, ask for the precise number of processors, 34 | # otherwise take 2 processors as reasonable default; see 35 | # https://docs.travis-ci.com/user/speeding-up-the-build/#Makefile-optimization 36 | if [ -x /usr/bin/getconf ]; then 37 | NPROCESSORS=$(/usr/bin/getconf _NPROCESSORS_ONLN) 38 | else 39 | NPROCESSORS=2 40 | fi 41 | 42 | # as of 2017-09-04 Travis CI reports 32 processors, but GCC build 43 | # crashes if parallelized too much (maybe memory consumption problem), 44 | # so limit to 4 processors for the time being. 45 | if [ $NPROCESSORS -gt 4 ] ; then 46 | echo "$0:Note: Limiting processors to use by make from $NPROCESSORS to 4." 47 | NPROCESSORS=4 48 | fi 49 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/ci/install-linux.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright 2017 Google Inc. 3 | # All Rights Reserved. 4 | # 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 | set -eu 33 | 34 | if [ "${TRAVIS_OS_NAME}" != linux ]; then 35 | echo "Not a Linux build; skipping installation" 36 | exit 0 37 | fi 38 | 39 | 40 | if [ "${TRAVIS_SUDO}" = "true" ]; then 41 | echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | \ 42 | sudo tee /etc/apt/sources.list.d/bazel.list 43 | curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add - 44 | sudo apt-get update && sudo apt-get install -y bazel gcc-4.9 g++-4.9 clang-3.9 45 | elif [ "${CXX}" = "clang++" ]; then 46 | # Use ccache, assuming $HOME/bin is in the path, which is true in the Travis build environment. 47 | ln -sf /usr/bin/ccache $HOME/bin/${CXX}; 48 | ln -sf /usr/bin/ccache $HOME/bin/${CC}; 49 | fi 50 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/ci/install-osx.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright 2017 Google Inc. 3 | # All Rights Reserved. 4 | # 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 | set -eu 33 | 34 | if [ "${TRAVIS_OS_NAME}" != "osx" ]; then 35 | echo "Not a macOS build; skipping installation" 36 | exit 0 37 | fi 38 | 39 | brew update 40 | brew install ccache gcc@4.9 41 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/ci/install-platformio.sh: -------------------------------------------------------------------------------- 1 | # install PlatformIO 2 | sudo pip install -U platformio 3 | 4 | # update PlatformIO 5 | platformio update 6 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/ci/log-config.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright 2017 Google Inc. 3 | # All Rights Reserved. 4 | # 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 | set -e 33 | 34 | # ccache on OS X needs installation first 35 | # reset ccache statistics 36 | ccache --zero-stats 37 | 38 | echo PATH=${PATH} 39 | 40 | echo "Compiler configuration:" 41 | echo CXX=${CXX} 42 | echo CC=${CC} 43 | echo CXXFLAGS=${CXXFLAGS} 44 | 45 | echo "C++ compiler version:" 46 | ${CXX} --version || echo "${CXX} does not seem to support the --version flag" 47 | ${CXX} -v || echo "${CXX} does not seem to support the -v flag" 48 | 49 | echo "C compiler version:" 50 | ${CC} --version || echo "${CXX} does not seem to support the --version flag" 51 | ${CC} -v || echo "${CXX} does not seem to support the -v flag" 52 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/ci/travis.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | set -evx 3 | 4 | . ci/get-nprocessors.sh 5 | 6 | # if possible, ask for the precise number of processors, 7 | # otherwise take 2 processors as reasonable default; see 8 | # https://docs.travis-ci.com/user/speeding-up-the-build/#Makefile-optimization 9 | if [ -x /usr/bin/getconf ]; then 10 | NPROCESSORS=$(/usr/bin/getconf _NPROCESSORS_ONLN) 11 | else 12 | NPROCESSORS=2 13 | fi 14 | # as of 2017-09-04 Travis CI reports 32 processors, but GCC build 15 | # crashes if parallelized too much (maybe memory consumption problem), 16 | # so limit to 4 processors for the time being. 17 | if [ $NPROCESSORS -gt 4 ] ; then 18 | echo "$0:Note: Limiting processors to use by make from $NPROCESSORS to 4." 19 | NPROCESSORS=4 20 | fi 21 | # Tell make to use the processors. No preceding '-' required. 22 | MAKEFLAGS="j${NPROCESSORS}" 23 | export MAKEFLAGS 24 | 25 | env | sort 26 | 27 | # Set default values to OFF for these variables if not specified. 28 | : "${NO_EXCEPTION:=OFF}" 29 | : "${NO_RTTI:=OFF}" 30 | : "${COMPILER_IS_GNUCXX:=OFF}" 31 | 32 | mkdir build || true 33 | cd build 34 | cmake -Dgtest_build_samples=ON \ 35 | -Dgtest_build_tests=ON \ 36 | -Dgmock_build_tests=ON \ 37 | -Dcxx_no_exception=$NO_EXCEPTION \ 38 | -Dcxx_no_rtti=$NO_RTTI \ 39 | -DCMAKE_COMPILER_IS_GNUCXX=$COMPILER_IS_GNUCXX \ 40 | -DCMAKE_CXX_FLAGS=$CXX_FLAGS \ 41 | -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ 42 | .. 43 | make 44 | CTEST_OUTPUT_ON_FAILURE=1 make test 45 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/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 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/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 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/googlemock/README.md: -------------------------------------------------------------------------------- 1 | # Googletest Mocking (gMock) Framework 2 | 3 | ### Overview 4 | 5 | Google's framework for writing and using C++ mock classes. It can help you 6 | derive better designs of your system and write better tests. 7 | 8 | It is inspired by: 9 | 10 | * [jMock](http://www.jmock.org/), 11 | * [EasyMock](http://www.easymock.org/), and 12 | * [Hamcrest](http://code.google.com/p/hamcrest/), 13 | 14 | and designed with C++'s specifics in mind. 15 | 16 | gMock: 17 | 18 | - provides a declarative syntax for defining mocks, 19 | - can define partial (hybrid) mocks, which are a cross of real and mock 20 | objects, 21 | - handles functions of arbitrary types and overloaded functions, 22 | - comes with a rich set of matchers for validating function arguments, 23 | - uses an intuitive syntax for controlling the behavior of a mock, 24 | - does automatic verification of expectations (no record-and-replay needed), 25 | - allows arbitrary (partial) ordering constraints on function calls to be 26 | expressed, 27 | - lets a user extend it by defining new matchers and actions. 28 | - does not use exceptions, and 29 | - is easy to learn and use. 30 | 31 | Details and examples can be found here: 32 | 33 | * [gMock for Dummies](docs/for_dummies.md) 34 | * [Legacy gMock FAQ](docs/gmock_faq.md) 35 | * [gMock Cookbook](docs/cook_book.md) 36 | * [gMock Cheat Sheet](docs/cheat_sheet.md) 37 | 38 | Please note that code under scripts/generator/ is from the [cppclean 39 | project](http://code.google.com/p/cppclean/) and under the Apache 40 | License, which is different from Google Mock's license. 41 | 42 | Google Mock is a part of 43 | [Google Test C++ testing framework](http://github.com/google/googletest/) and a 44 | subject to the same requirements. 45 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/googlemock/cmake/gmock.pc.in: -------------------------------------------------------------------------------- 1 | prefix=${pcfiledir}/../.. 2 | libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ 3 | includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ 4 | 5 | Name: gmock 6 | Description: GoogleMock (without main() function) 7 | Version: @PROJECT_VERSION@ 8 | URL: https://github.com/google/googletest 9 | Requires: gtest 10 | Libs: -L${libdir} -lgmock @CMAKE_THREAD_LIBS_INIT@ 11 | Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@ @CMAKE_THREAD_LIBS_INIT@ 12 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/googlemock/cmake/gmock_main.pc.in: -------------------------------------------------------------------------------- 1 | prefix=${pcfiledir}/../.. 2 | libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ 3 | includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ 4 | 5 | Name: gmock_main 6 | Description: GoogleMock (with main() function) 7 | Version: @PROJECT_VERSION@ 8 | URL: https://github.com/google/googletest 9 | Requires: gmock 10 | Libs: -L${libdir} -lgmock_main @CMAKE_THREAD_LIBS_INIT@ 11 | Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@ @CMAKE_THREAD_LIBS_INIT@ 12 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/googlemock/include/gmock/internal/custom/README.md: -------------------------------------------------------------------------------- 1 | # Customization Points 2 | 3 | The custom directory is an injection point for custom user configurations. 4 | 5 | ## Header `gmock-port.h` 6 | 7 | The following macros can be defined: 8 | 9 | ### Flag related macros: 10 | 11 | * `GMOCK_DECLARE_bool_(name)` 12 | * `GMOCK_DECLARE_int32_(name)` 13 | * `GMOCK_DECLARE_string_(name)` 14 | * `GMOCK_DEFINE_bool_(name, default_val, doc)` 15 | * `GMOCK_DEFINE_int32_(name, default_val, doc)` 16 | * `GMOCK_DEFINE_string_(name, default_val, doc)` 17 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/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 | // GOOGLETEST_CM0002 DO NOT DELETE 6 | 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 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/googlemock/include/gmock/internal/custom/gmock-generated-actions.h.pump: -------------------------------------------------------------------------------- 1 | $$ -*- mode: c++; -*- 2 | $$ This is a Pump source file. 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 | 8 | // GOOGLETEST_CM0002 DO NOT DELETE 9 | #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ 10 | #define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ 11 | 12 | #endif // GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ 13 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/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 | // Injection point for custom user configurations. See README for details 31 | // 32 | // GOOGLETEST_CM0002 DO NOT DELETE 33 | 34 | #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_MATCHERS_H_ 35 | #define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_MATCHERS_H_ 36 | #endif // GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_MATCHERS_H_ 37 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/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. See README for details 31 | // 32 | // ** Custom implementation starts here ** 33 | 34 | // GOOGLETEST_CM0002 DO NOT DELETE 35 | 36 | #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_ 37 | #define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_ 38 | 39 | #endif // GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_ 40 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/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, visit http://code.google.com/p/cppclean/ 4 | 5 | The mock generator requires Python 2.3.5 or later. If you don't have Python 6 | installed on your system, you will also need to install it. You can download 7 | Python from: http://www.python.org/download/releases/ 8 | 9 | To use the Google Mock class generator, you need to call it 10 | on the command line passing the header file and class for which you want 11 | to generate a Google Mock class. 12 | 13 | Make sure to install the scripts somewhere in your path. Then you can 14 | run the program. 15 | 16 | gmock_gen.py header-file.h [ClassName]... 17 | 18 | If no ClassNames are specified, all classes in the file are emitted. 19 | 20 | To change the indentation from the default of 2, set INDENT in 21 | the environment. For example to use an indent of 4 spaces: 22 | 23 | INDENT=4 gmock_gen.py header-file.h ClassName 24 | 25 | This version was made from SVN revision 281 in the cppclean repository. 26 | 27 | Known Limitations 28 | ----------------- 29 | Not all code will be generated properly. For example, when mocking templated 30 | classes, the template information is lost. You will need to add the template 31 | information manually. 32 | 33 | Not all permutations of using multiple pointers/references will be rendered 34 | properly. These will also have to be fixed manually. 35 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/googlemock/scripts/generator/cpp/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FFMG/myoddweb.directorywatcher/9a35a2ba3122157f86ab7aa084e8128cfc2148e3/src/packages/googletest-release-1.10.0/googlemock/scripts/generator/cpp/__init__.py -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/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 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/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 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/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 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/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 | // 31 | // Google C++ Mocking Framework (Google Mock) 32 | // 33 | // This file #includes all Google Mock implementation .cc files. The 34 | // purpose is to allow a user to build Google Mock by compiling this 35 | // file alone. 36 | 37 | // This line ensures that gmock.h can be compiled on its own, even 38 | // when it's fused. 39 | #include "gmock/gmock.h" 40 | 41 | // The following lines pull in the real gmock *.cc files. 42 | #include "src/gmock-cardinalities.cc" 43 | #include "src/gmock-internal-utils.cc" 44 | #include "src/gmock-matchers.cc" 45 | #include "src/gmock-spec-builders.cc" 46 | #include "src/gmock.cc" 47 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/googlemock/test/gmock-function-mocker_nc.cc: -------------------------------------------------------------------------------- 1 | #include "gmock/gmock.h" 2 | 3 | #include 4 | #include 5 | 6 | #if defined(TEST_MOCK_METHOD_INVALID_CONST_SPEC) 7 | 8 | struct Base { 9 | MOCK_METHOD(int, F, (), (onst)); 10 | }; 11 | 12 | #else 13 | 14 | // Sanity check - this should compile. 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/googlemock/test/gmock-function-mocker_nc_test.py: -------------------------------------------------------------------------------- 1 | """Negative compilation tests for Google Mock macro MOCK_METHOD.""" 2 | 3 | import os 4 | import sys 5 | 6 | IS_LINUX = os.name == "posix" and os.uname()[0] == "Linux" 7 | if not IS_LINUX: 8 | sys.stderr.write( 9 | "WARNING: Negative compilation tests are not supported on this platform") 10 | sys.exit(0) 11 | 12 | # Suppresses the 'Import not at the top of the file' lint complaint. 13 | # pylint: disable-msg=C6204 14 | from google3.testing.pybase import fake_target_util 15 | from google3.testing.pybase import googletest 16 | 17 | # pylint: enable-msg=C6204 18 | 19 | 20 | class GMockMethodNCTest(googletest.TestCase): 21 | """Negative compilation tests for MOCK_METHOD.""" 22 | 23 | # The class body is intentionally empty. The actual test*() methods 24 | # will be defined at run time by a call to 25 | # DefineNegativeCompilationTests() later. 26 | pass 27 | 28 | 29 | # Defines a list of test specs, where each element is a tuple 30 | # (test name, list of regexes for matching the compiler errors). 31 | TEST_SPECS = [ 32 | ("MOCK_METHOD_INVALID_CONST_SPEC", 33 | [r"onst cannot be recognized as a valid specification modifier"]), 34 | ] 35 | 36 | # Define a test method in GMockNCTest for each element in TEST_SPECS. 37 | fake_target_util.DefineNegativeCompilationTests( 38 | GMockMethodNCTest, 39 | "google3/third_party/googletest/googlemock/test/gmock-function-mocker_nc", 40 | "gmock-function-mocker_nc.o", TEST_SPECS) 41 | 42 | if __name__ == "__main__": 43 | googletest.main() 44 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/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 | 31 | // Google Mock - a framework for writing C++ mock classes. 32 | // 33 | // This file tests the internal cross-platform support utilities. 34 | 35 | #include "gmock/internal/gmock-port.h" 36 | #include "gtest/gtest.h" 37 | 38 | // NOTE: if this file is left without tests for some reason, put a dummy 39 | // test here to make references to symbols in the gtest library and avoid 40 | // 'undefined symbol' linker errors in gmock_main: 41 | 42 | TEST(DummyTest, Dummy) {} 43 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/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 | 31 | // Google Mock - a framework for writing C++ mock classes. 32 | // 33 | // This file is for verifying that various Google Mock constructs do not 34 | // produce linker errors when instantiated in different translation units. 35 | // Please see gmock_link_test.h for details. 36 | 37 | #define LinkTest LinkTest2 38 | 39 | #include "test/gmock_link_test.h" 40 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/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 | 31 | // Google Mock - a framework for writing C++ mock classes. 32 | // 33 | // This file is for verifying that various Google Mock constructs do not 34 | // produce linker errors when instantiated in different translation units. 35 | // Please see gmock_link_test.h for details. 36 | 37 | #define LinkTest LinkTest1 38 | 39 | #include "test/gmock_link_test.h" 40 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/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 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/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 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/googletest/cmake/Config.cmake.in: -------------------------------------------------------------------------------- 1 | @PACKAGE_INIT@ 2 | include(CMakeFindDependencyMacro) 3 | if (@GTEST_HAS_PTHREAD@) 4 | set(THREADS_PREFER_PTHREAD_FLAG @THREADS_PREFER_PTHREAD_FLAG@) 5 | find_dependency(Threads) 6 | endif() 7 | 8 | include("${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake") 9 | check_required_components("@project_name@") 10 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/googletest/cmake/gtest.pc.in: -------------------------------------------------------------------------------- 1 | prefix=${pcfiledir}/../.. 2 | libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ 3 | includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ 4 | 5 | Name: gtest 6 | Description: GoogleTest (without main() function) 7 | Version: @PROJECT_VERSION@ 8 | URL: https://github.com/google/googletest 9 | Libs: -L${libdir} -lgtest @CMAKE_THREAD_LIBS_INIT@ 10 | Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@ @CMAKE_THREAD_LIBS_INIT@ 11 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/googletest/cmake/gtest_main.pc.in: -------------------------------------------------------------------------------- 1 | prefix=${pcfiledir}/../.. 2 | libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ 3 | includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ 4 | 5 | Name: gtest_main 6 | Description: GoogleTest (with main() function) 7 | Version: @PROJECT_VERSION@ 8 | URL: https://github.com/google/googletest 9 | Requires: gtest 10 | Libs: -L${libdir} -lgtest_main @CMAKE_THREAD_LIBS_INIT@ 11 | Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@ @CMAKE_THREAD_LIBS_INIT@ 12 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/googletest/cmake/libgtest.la.in: -------------------------------------------------------------------------------- 1 | # libgtest.la - a libtool library file 2 | # Generated by libtool (GNU libtool) 2.4.6 3 | 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # Names of this library. 8 | library_names='libgtest.so' 9 | 10 | # Is this an already installed library? 11 | installed=yes 12 | 13 | # Should we warn about portability when linking against -modules? 14 | shouldnotlink=no 15 | 16 | # Files to dlopen/dlpreopen 17 | dlopen='' 18 | dlpreopen='' 19 | 20 | # Directory that this library needs to be installed in: 21 | libdir='@CMAKE_INSTALL_FULL_LIBDIR@' 22 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/googletest/docs/samples.md: -------------------------------------------------------------------------------- 1 | # Googletest Samples {#samples} 2 | 3 | If you're like us, you'd like to look at 4 | [googletest samples.](https://github.com/google/googletest/tree/master/googletest/samples) 5 | The sample directory has a number of well-commented samples showing how to use a 6 | variety of googletest features. 7 | 8 | * Sample #1 shows the basic steps of using googletest to test C++ functions. 9 | * Sample #2 shows a more complex unit test for a class with multiple member 10 | functions. 11 | * Sample #3 uses a test fixture. 12 | * Sample #4 teaches you how to use googletest and `googletest.h` together to 13 | get the best of both libraries. 14 | * Sample #5 puts shared testing logic in a base test fixture, and reuses it in 15 | derived fixtures. 16 | * Sample #6 demonstrates type-parameterized tests. 17 | * Sample #7 teaches the basics of value-parameterized tests. 18 | * Sample #8 shows using `Combine()` in value-parameterized tests. 19 | * Sample #9 shows use of the listener API to modify Google Test's console 20 | output and the use of its reflection API to inspect test results. 21 | * Sample #10 shows use of the listener API to implement a primitive memory 22 | leak checker. 23 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/googletest/include/gtest/internal/custom/README.md: -------------------------------------------------------------------------------- 1 | # Customization Points 2 | 3 | The custom directory is an injection point for custom user configurations. 4 | 5 | ## Header `gtest.h` 6 | 7 | ### The following macros can be defined: 8 | 9 | * `GTEST_OS_STACK_TRACE_GETTER_` - The name of an implementation of 10 | `OsStackTraceGetterInterface`. 11 | * `GTEST_CUSTOM_TEMPDIR_FUNCTION_` - An override for `testing::TempDir()`. See 12 | `testing::TempDir` for semantics and signature. 13 | 14 | ## Header `gtest-port.h` 15 | 16 | The following macros can be defined: 17 | 18 | ### Flag related macros: 19 | 20 | * `GTEST_FLAG(flag_name)` 21 | * `GTEST_USE_OWN_FLAGFILE_FLAG_` - Define to 0 when the system provides its 22 | own flagfile flag parsing. 23 | * `GTEST_DECLARE_bool_(name)` 24 | * `GTEST_DECLARE_int32_(name)` 25 | * `GTEST_DECLARE_string_(name)` 26 | * `GTEST_DEFINE_bool_(name, default_val, doc)` 27 | * `GTEST_DEFINE_int32_(name, default_val, doc)` 28 | * `GTEST_DEFINE_string_(name, default_val, doc)` 29 | 30 | ### Logging: 31 | 32 | * `GTEST_LOG_(severity)` 33 | * `GTEST_CHECK_(condition)` 34 | * Functions `LogToStderr()` and `FlushInfoLog()` have to be provided too. 35 | 36 | ### Threading: 37 | 38 | * `GTEST_HAS_NOTIFICATION_` - Enabled if Notification is already provided. 39 | * `GTEST_HAS_MUTEX_AND_THREAD_LOCAL_` - Enabled if `Mutex` and `ThreadLocal` 40 | are already provided. Must also provide `GTEST_DECLARE_STATIC_MUTEX_(mutex)` 41 | and `GTEST_DEFINE_STATIC_MUTEX_(mutex)` 42 | * `GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks)` 43 | * `GTEST_LOCK_EXCLUDED_(locks)` 44 | 45 | ### Underlying library support features 46 | 47 | * `GTEST_HAS_CXXABI_H_` 48 | 49 | ### Exporting API symbols: 50 | 51 | * `GTEST_API_` - Specifier for exported symbols. 52 | 53 | ## Header `gtest-printers.h` 54 | 55 | * See documentation at `gtest/gtest-printers.h` for details on how to define a 56 | custom printer. 57 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/googletest/include/gtest/internal/custom/gtest-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. See README for details 31 | // 32 | // ** Custom implementation starts here ** 33 | 34 | #ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_ 35 | #define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_ 36 | 37 | #endif // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_ 38 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/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 | // 35 | // Injection point for custom user configurations. See README for details 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 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/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. See README for details 31 | // 32 | // ** Custom implementation starts here ** 33 | 34 | #ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_ 35 | #define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_ 36 | 37 | #endif // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_ 38 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/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 | #ifndef GTEST_SAMPLES_SAMPLE1_H_ 33 | #define GTEST_SAMPLES_SAMPLE1_H_ 34 | 35 | // Returns n! (the factorial of n). For negative n, n! is defined to be 1. 36 | int Factorial(int n); 37 | 38 | // Returns true if and only if n is a prime number. 39 | bool IsPrime(int n); 40 | 41 | #endif // GTEST_SAMPLES_SAMPLE1_H_ 42 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/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 | #include 33 | 34 | #include "sample4.h" 35 | 36 | // Returns the current counter value, and increments it. 37 | int Counter::Increment() { 38 | return counter_++; 39 | } 40 | 41 | // Returns the current counter value, and decrements it. 42 | // counter can not be less than 0, return 0 in this case 43 | int Counter::Decrement() { 44 | if (counter_ == 0) { 45 | return counter_; 46 | } else { 47 | return counter_--; 48 | } 49 | } 50 | 51 | // Prints the current counter value to STDOUT. 52 | void Counter::Print() const { 53 | printf("%d", counter_); 54 | } 55 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/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 | #ifndef GTEST_SAMPLES_SAMPLE4_H_ 32 | #define GTEST_SAMPLES_SAMPLE4_H_ 33 | 34 | // A simple monotonic counter. 35 | class Counter { 36 | private: 37 | int counter_; 38 | 39 | public: 40 | // Creates a counter that starts at 0. 41 | Counter() : counter_(0) {} 42 | 43 | // Returns the current counter value, and increments it. 44 | int Increment(); 45 | 46 | // Returns the current counter value, and decrements it. 47 | int Decrement(); 48 | 49 | // Prints the current counter value to STDOUT. 50 | void Print() const; 51 | }; 52 | 53 | #endif // GTEST_SAMPLES_SAMPLE4_H_ 54 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/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 | 31 | #include "sample4.h" 32 | #include "gtest/gtest.h" 33 | 34 | namespace { 35 | // Tests the Increment() method. 36 | 37 | TEST(Counter, Increment) { 38 | Counter c; 39 | 40 | // Test that counter 0 returns 0 41 | EXPECT_EQ(0, c.Decrement()); 42 | 43 | // EXPECT_EQ() evaluates its arguments exactly once, so they 44 | // can have side effects. 45 | 46 | EXPECT_EQ(0, c.Increment()); 47 | EXPECT_EQ(1, c.Increment()); 48 | EXPECT_EQ(2, c.Increment()); 49 | 50 | EXPECT_EQ(3, c.Decrement()); 51 | } 52 | 53 | } // namespace 54 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/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 | // 31 | // Google C++ Testing and Mocking Framework (Google Test) 32 | // 33 | // Sometimes it's desirable to build Google Test by compiling a single file. 34 | // This file serves this purpose. 35 | 36 | // This line ensures that gtest.h can be compiled on its own, even 37 | // when it's fused. 38 | #include "gtest/gtest.h" 39 | 40 | // The following lines pull in the real gtest *.cc files. 41 | #include "src/gtest.cc" 42 | #include "src/gtest-death-test.cc" 43 | #include "src/gtest-filepath.cc" 44 | #include "src/gtest-matchers.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 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/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 | #include "gtest/gtest.h" 32 | 33 | #ifdef ARDUINO 34 | void setup() { 35 | testing::InitGoogleTest(); 36 | } 37 | 38 | void loop() { RUN_ALL_TESTS(); } 39 | 40 | #else 41 | 42 | GTEST_API_ int main(int argc, char **argv) { 43 | printf("Running main() from %s\n", __FILE__); 44 | testing::InitGoogleTest(&argc, argv); 45 | return RUN_ALL_TESTS(); 46 | } 47 | #endif 48 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/googletest/test/googletest-param-test-invalid-name1-test_.cc: -------------------------------------------------------------------------------- 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 | #include "gtest/gtest.h" 32 | 33 | namespace { 34 | class DummyTest : public ::testing::TestWithParam {}; 35 | 36 | TEST_P(DummyTest, Dummy) { 37 | } 38 | 39 | INSTANTIATE_TEST_SUITE_P(InvalidTestName, 40 | DummyTest, 41 | ::testing::Values("InvalidWithQuotes"), 42 | ::testing::PrintToStringParamName()); 43 | 44 | } // namespace 45 | 46 | int main(int argc, char *argv[]) { 47 | testing::InitGoogleTest(&argc, argv); 48 | return RUN_ALL_TESTS(); 49 | } 50 | 51 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/googletest/test/googletest-param-test-invalid-name2-test_.cc: -------------------------------------------------------------------------------- 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 | #include "gtest/gtest.h" 32 | 33 | namespace { 34 | class DummyTest : public ::testing::TestWithParam {}; 35 | 36 | std::string StringParamTestSuffix( 37 | const testing::TestParamInfo& info) { 38 | return std::string(info.param); 39 | } 40 | 41 | TEST_P(DummyTest, Dummy) { 42 | } 43 | 44 | INSTANTIATE_TEST_SUITE_P(DuplicateTestNames, 45 | DummyTest, 46 | ::testing::Values("a", "b", "a", "c"), 47 | StringParamTestSuffix); 48 | } // namespace 49 | 50 | int main(int argc, char *argv[]) { 51 | testing::InitGoogleTest(&argc, argv); 52 | return RUN_ALL_TESTS(); 53 | } 54 | 55 | 56 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/googletest/test/googletest-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 | 31 | #include "gtest/gtest.h" 32 | 33 | TEST(DummyTest, Dummy) { 34 | // This test doesn't verify anything. We just need it to create a 35 | // realistic stage for testing the behavior of Google Test when 36 | // RUN_ALL_TESTS() is called without 37 | // testing::InitGoogleTest() being called first. 38 | } 39 | 40 | int main() { 41 | return RUN_ALL_TESTS(); 42 | } 43 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/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 | 31 | #include 32 | 33 | #include "test/gtest-typed-test_test.h" 34 | #include "gtest/gtest.h" 35 | 36 | #if GTEST_HAS_TYPED_TEST_P 37 | 38 | // Tests that the same type-parameterized test case can be 39 | // instantiated in different translation units linked together. 40 | // (ContainerTest is also instantiated in gtest-typed-test_test.cc.) 41 | INSTANTIATE_TYPED_TEST_SUITE_P(Vector, ContainerTest, 42 | testing::Types >); 43 | 44 | #endif // GTEST_HAS_TYPED_TEST_P 45 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/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 | 31 | // This program is meant to be run by gtest_help_test.py. Do not run 32 | // it directly. 33 | 34 | #include "gtest/gtest.h" 35 | 36 | // When a help flag is specified, this program should skip the tests 37 | // and exit with 0; otherwise the following test will be executed, 38 | // causing this program to exit with a non-zero code. 39 | TEST(HelpFlagTest, ShouldNotBeRun) { 40 | ASSERT_TRUE(false) << "Tests shouldn't be run when --help is specified."; 41 | } 42 | 43 | #if GTEST_HAS_DEATH_TEST 44 | TEST(DeathTest, UsedByPythonScriptToDetectSupportForDeathTestsInThisBinary) {} 45 | #endif 46 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/googletest/test/gtest_list_output_unittest_.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2018, 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: david.schuldenfrei@gmail.com (David Schuldenfrei) 31 | 32 | // Unit test for Google Test's --gtest_list_tests and --gtest_output flag. 33 | // 34 | // A user can ask Google Test to list all tests that will run, 35 | // and have the output saved in a Json/Xml file. 36 | // The tests will not be run after listing. 37 | // 38 | // This program will be invoked from a Python unit test. 39 | // Don't run it directly. 40 | 41 | #include "gtest/gtest.h" 42 | 43 | TEST(FooTest, Test1) {} 44 | 45 | TEST(FooTest, Test2) {} 46 | 47 | int main(int argc, char **argv) { 48 | ::testing::InitGoogleTest(&argc, argv); 49 | 50 | return RUN_ALL_TESTS(); 51 | } 52 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/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 | 31 | #include "gtest/gtest.h" 32 | 33 | // Tests that we don't have to define main() when we link to 34 | // gtest_main instead of gtest. 35 | 36 | namespace { 37 | 38 | TEST(GTestMainTest, ShouldSucceed) { 39 | } 40 | 41 | } // namespace 42 | 43 | // We are using the main() function defined in gtest_main.cc, so we 44 | // don't define it here. 45 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/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 | // 31 | // Unit test for gtest_prod.h. 32 | 33 | #include "production.h" 34 | #include "gtest/gtest.h" 35 | 36 | // Tests that private members can be accessed from a TEST declared as 37 | // a friend of the class. 38 | TEST(PrivateCodeTest, CanAccessPrivateMembers) { 39 | PrivateCode a; 40 | EXPECT_EQ(0, a.x_); 41 | 42 | a.set_x(1); 43 | EXPECT_EQ(1, a.x_); 44 | } 45 | 46 | typedef testing::Test PrivateCodeFixtureTest; 47 | 48 | // Tests that private members can be accessed from a TEST_F declared 49 | // as a friend of the class. 50 | TEST_F(PrivateCodeFixtureTest, CanAccessPrivateMembers) { 51 | PrivateCode a; 52 | EXPECT_EQ(0, a.x_); 53 | 54 | a.set_x(2); 55 | EXPECT_EQ(2, a.x_); 56 | } 57 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/googletest/test/gtest_skip_in_environment_setup_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2019, Google LLC. 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 LLC. 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 test verifies that skipping in the environment results in the 31 | // testcases being skipped. 32 | 33 | #include 34 | #include "gtest/gtest.h" 35 | 36 | class SetupEnvironment : public testing::Environment { 37 | public: 38 | void SetUp() override { GTEST_SKIP() << "Skipping the entire environment"; } 39 | }; 40 | 41 | TEST(Test, AlwaysFails) { EXPECT_EQ(true, false); } 42 | 43 | int main(int argc, char **argv) { 44 | testing::InitGoogleTest(&argc, argv); 45 | 46 | testing::AddGlobalTestEnvironment(new SetupEnvironment()); 47 | 48 | return RUN_ALL_TESTS(); 49 | } 50 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/googletest/test/gtest_skip_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: arseny.aprelev@gmail.com (Arseny Aprelev) 31 | // 32 | 33 | #include "gtest/gtest.h" 34 | 35 | using ::testing::Test; 36 | 37 | TEST(SkipTest, DoesSkip) { 38 | GTEST_SKIP(); 39 | EXPECT_EQ(0, 1); 40 | } 41 | 42 | class Fixture : public Test { 43 | protected: 44 | void SetUp() override { 45 | GTEST_SKIP() << "skipping all tests for this fixture"; 46 | } 47 | }; 48 | 49 | TEST_F(Fixture, SkipsOneTest) { 50 | EXPECT_EQ(5, 7); 51 | } 52 | 53 | TEST_F(Fixture, SkipsAnotherTest) { 54 | EXPECT_EQ(99, 100); 55 | } 56 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/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 | // 31 | // This test verifies that it's possible to use Google Test by including 32 | // the gtest.h header file alone. 33 | 34 | #include "gtest/gtest.h" 35 | 36 | namespace { 37 | 38 | void Subroutine() { 39 | EXPECT_EQ(42, 42); 40 | } 41 | 42 | TEST(NoFatalFailureTest, ExpectNoFatalFailure) { 43 | EXPECT_NO_FATAL_FAILURE(;); 44 | EXPECT_NO_FATAL_FAILURE(SUCCEED()); 45 | EXPECT_NO_FATAL_FAILURE(Subroutine()); 46 | EXPECT_NO_FATAL_FAILURE({ SUCCEED(); }); 47 | } 48 | 49 | TEST(NoFatalFailureTest, AssertNoFatalFailure) { 50 | ASSERT_NO_FATAL_FAILURE(;); 51 | ASSERT_NO_FATAL_FAILURE(SUCCEED()); 52 | ASSERT_NO_FATAL_FAILURE(Subroutine()); 53 | ASSERT_NO_FATAL_FAILURE({ SUCCEED(); }); 54 | } 55 | 56 | } // namespace 57 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/googletest/test/gtest_testbridge_test_.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2018, Google LLC. 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 | // This program is meant to be run by gtest_test_filter_test.py. Do not run 32 | // it directly. 33 | 34 | #include "gtest/gtest.h" 35 | 36 | // These tests are used to detect if filtering is working. Only 37 | // 'TestThatSucceeds' should ever run. 38 | 39 | TEST(TestFilterTest, TestThatSucceeds) {} 40 | 41 | TEST(TestFilterTest, TestThatFails) { 42 | ASSERT_TRUE(false) << "This test should never be run."; 43 | } 44 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/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 | // gtest_xml_outfile1_test_ writes some xml via TestProperty used by 31 | // gtest_xml_outfiles_test.py 32 | 33 | #include "gtest/gtest.h" 34 | 35 | class PropertyOne : public testing::Test { 36 | protected: 37 | void SetUp() override { RecordProperty("SetUpProp", 1); } 38 | void TearDown() override { RecordProperty("TearDownProp", 1); } 39 | }; 40 | 41 | TEST_F(PropertyOne, TestSomeProperties) { 42 | RecordProperty("TestSomeProperty", 1); 43 | } 44 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/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 | // gtest_xml_outfile2_test_ writes some xml via TestProperty used by 31 | // gtest_xml_outfiles_test.py 32 | 33 | #include "gtest/gtest.h" 34 | 35 | class PropertyTwo : public testing::Test { 36 | protected: 37 | void SetUp() override { RecordProperty("SetUpProp", 2); } 38 | void TearDown() override { RecordProperty("TearDownProp", 2); } 39 | }; 40 | 41 | TEST_F(PropertyTwo, TestSomeProperties) { 42 | RecordProperty("TestSomeProperty", 2); 43 | } 44 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/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 | // 31 | // This is part of the unit test for gtest_prod.h. 32 | 33 | #include "production.h" 34 | 35 | PrivateCode::PrivateCode() : x_(0) {} 36 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/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 | // 31 | // This is part of the unit test for gtest_prod.h. 32 | 33 | #ifndef GTEST_TEST_PRODUCTION_H_ 34 | #define GTEST_TEST_PRODUCTION_H_ 35 | 36 | #include "gtest/gtest_prod.h" 37 | 38 | class PrivateCode { 39 | public: 40 | // Declares a friend test that does not use a fixture. 41 | FRIEND_TEST(PrivateCodeTest, CanAccessPrivateMembers); 42 | 43 | // Declares a friend test that uses a fixture. 44 | FRIEND_TEST(PrivateCodeFixtureTest, CanAccessPrivateMembers); 45 | 46 | PrivateCode(); 47 | 48 | int x() const { return x_; } 49 | private: 50 | void set_x(int an_x) { x_ = an_x; } 51 | int x_; 52 | }; 53 | 54 | #endif // GTEST_TEST_PRODUCTION_H_ 55 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/library.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "googletest", 3 | "keywords": "unittest, unit, test, gtest, gmock", 4 | "description": "googletest is a testing framework developed by the Testing Technology team with Google's specific requirements and constraints in mind. No matter whether you work on Linux, Windows, or a Mac, if you write C++ code, googletest can help you. And it supports any kind of tests, not just unit tests.", 5 | "license": "BSD-3-Clause", 6 | "homepage": "https://github.com/google/googletest/blob/master/README.md", 7 | "repository": { 8 | "type": "git", 9 | "url": "https://github.com/google/googletest.git" 10 | }, 11 | "version": "1.8.1", 12 | "frameworks": "arduino", 13 | "platforms": [ 14 | "espressif32" 15 | ], 16 | "export": { 17 | "include": [ 18 | "googlemock/include/*", 19 | "googlemock/src/*", 20 | "googletest/include/*", 21 | "googletest/src/*" 22 | ], 23 | "exclude": [ 24 | "ci", 25 | "googlemock/build-aux", 26 | "googlemock/cmake", 27 | "googlemock/make", 28 | "googlemock/msvc", 29 | "googlemock/scripts", 30 | "googlemock/src/gmock-all.cc", 31 | "googlemock/src/gmock_main.cc", 32 | "googlemock/test", 33 | "googlemock/CMakeLists.txt", 34 | "googlemock/Makefile.am", 35 | "googlemock/configure.ac", 36 | "googletest/cmake", 37 | "googletest/codegear", 38 | "googletest/m4", 39 | "googletest/make", 40 | "googletest/msvc", 41 | "googletest/scripts", 42 | "googletest/src/gtest-all.cc", 43 | "googletest/src/gtest_main.cc", 44 | "googletest/test", 45 | "googletest/xcode", 46 | "googletest/CMakeLists.txt", 47 | "googletest/Makefile.am", 48 | "googletest/configure.ac" 49 | ] 50 | }, 51 | "build": { 52 | "flags": [ 53 | "-Igooglemock/include", 54 | "-Igooglemock", 55 | "-Igoogletest/include", 56 | "-Igoogletest" 57 | ] 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/packages/googletest-release-1.10.0/platformio.ini: -------------------------------------------------------------------------------- 1 | ; PlatformIO Project Configuration File 2 | ; 3 | ; Build options: build flags, source filter 4 | ; Upload options: custom upload port, speed and extra flags 5 | ; Library options: dependencies, extra library storages 6 | ; Advanced options: extra scripting 7 | ; 8 | ; Please visit documentation for the other options and examples 9 | ; http://docs.platformio.org/page/projectconf.html 10 | 11 | 12 | [platformio] 13 | #src_dir = ./googlemock 14 | #src_dir = ./googletest 15 | src_dir = . 16 | 17 | [env:googletest_esp32] 18 | platform = espressif32 19 | board = esp32dev 20 | framework = arduino 21 | build_flags = -I./googletest/include -I./googletest 22 | src_filter = +<*> -<.git/> - - - - - - + + 23 | upload_speed = 921600 24 | 25 | [env:googlemock_esp32] 26 | platform = espressif32 27 | board = esp32dev 28 | framework = arduino 29 | build_flags = -I./googlemock/include -I./googletest/include -I./googletest -I./googlemock 30 | src_filter = +<*> -<.git/> - - - + + + 31 | upload_speed = 921600 32 | -------------------------------------------------------------------------------- /testing.md: -------------------------------------------------------------------------------- 1 | # Load testing application 2 | 3 | ## General 4 | 5 | Very simple load application tat allows us to test various aspects of `myoddweb.directorywatcher` 6 | 7 | `--help` : display the help screen 8 | 9 | ``` 10 | Usage: myoddweb.directorywatcher.load.exe 11 | [--iterations, --i=<5>] 12 | [--folders, --f=<5>] 13 | [--change, --c=<10>] 14 | [--unique, --u=] 15 | [--stats, --s=] 16 | [--quiet, --q=] 17 | [--drives, --d=] 18 | [--random, --r=] 19 | [--help, --h] 20 | 21 | help, h :Display the help message 22 | iterations, i :The number of test itarations we wish to run. 23 | This is the number of time we want to randomly stop/start watching a folder. 24 | folders, f :The number of folders watched at once. 25 | change, c :How often we want to change to another folder (in seconds). 26 | unique, u :If we want to use a unique watcher, shared, or use a watcher per directory. 27 | stats, s :Display stats every 10 seconds. 28 | quiet, q :Do not display the folder updates. 29 | drives, d :Test all the drives only. 30 | random, r :Randomly create various folders/files and check for update. 31 | ``` 32 | 33 | ## Random 34 | 35 | Example: `--iterations 5 --q true --r true` 36 | 37 | Run a test for `x` iterations and add/remove files at random intervals, the idea being that changes are still picked up after a while. 38 | 39 | We start a watcher that monitors all the folders and all the files, so it is the "maximum" case. 40 | 41 | # Strong Name Signing 42 | 43 | locate sn.exe 44 | 45 | Create a signature file, `sn -k "myoddweb.directorywatcher.snk"` 46 | 47 | Create a public file off the snk file, `sn -p "myoddweb.directorywatcher.snk" "pmyoddweb.directorywatcher.snk"` 48 | 49 | Output the public key: `sn -tp "pmyoddweb.directorywatcher.snk"` 50 | 51 | ## More 52 | 53 | - https://docs.microsoft.com/en-us/dotnet/framework/tools/sn-exe-strong-name-tool 54 | - https://docs.microsoft.com/en-us/dotnet/standard/assembly/create-public-private-key-pair 55 | -------------------------------------------------------------------------------- /tools/nuget/nuget.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FFMG/myoddweb.directorywatcher/9a35a2ba3122157f86ab7aa084e8128cfc2148e3/tools/nuget/nuget.exe --------------------------------------------------------------------------------