diff options
| author | 2021-11-10 00:54:35 -0500 | |
|---|---|---|
| committer | 2021-11-10 00:54:35 -0500 | |
| commit | 58fb7a0cee13d84170aac52f3f89d91888e1afe3 (patch) | |
| tree | 1d6312ba15f9ece5a8031e5280dfb8b38be8dfa3 /src/test/global | |
| parent | 28db84b46139c9bb2bbcac8c6cc56e71d1e35629 (diff) | |
| parent | beb08eb751fa8e1f72042f263316ab5e5ddb596d (diff) | |
Update upstream source from tag 'upstream/2.4.0+dfsg'
Update to upstream version '2.4.0+dfsg'
with Debian dir 4b6668cc08c7b0e56b1e1f7b4e89ecdb316182a0
Diffstat (limited to 'src/test/global')
| -rw-r--r-- | src/test/global/TestEventQueue.cpp | 6 | ||||
| -rw-r--r-- | src/test/global/TestEventQueue.h | 4 | ||||
| -rw-r--r-- | src/test/global/TestUtils.cpp | 37 | ||||
| -rw-r--r-- | src/test/global/TestUtils.h | 30 | ||||
| -rw-r--r-- | src/test/global/gmock.h | 4 | ||||
| -rw-r--r-- | src/test/global/gtest.h | 4 |
6 files changed, 76 insertions, 9 deletions
diff --git a/src/test/global/TestEventQueue.cpp b/src/test/global/TestEventQueue.cpp index 4dd01e7..253e9ab 100644 --- a/src/test/global/TestEventQueue.cpp +++ b/src/test/global/TestEventQueue.cpp @@ -1,11 +1,11 @@ /* * barrier -- mouse and keyboard sharing utility * Copyright (C) 2013-2016 Symless Ltd. - * + * * This package is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * found in the file LICENSE that should have accompanied this file. - * + * * This package is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -23,7 +23,7 @@ #include <stdexcept> void -TestEventQueue::raiseQuitEvent() +TestEventQueue::raiseQuitEvent() { addEvent(Event(Event::kQuit)); } diff --git a/src/test/global/TestEventQueue.h b/src/test/global/TestEventQueue.h index b932508..14568b6 100644 --- a/src/test/global/TestEventQueue.h +++ b/src/test/global/TestEventQueue.h @@ -1,11 +1,11 @@ /* * barrier -- mouse and keyboard sharing utility * Copyright (C) 2013-2016 Symless Ltd. - * + * * This package is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * found in the file LICENSE that should have accompanied this file. - * + * * This package is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/src/test/global/TestUtils.cpp b/src/test/global/TestUtils.cpp new file mode 100644 index 0000000..6a3193b --- /dev/null +++ b/src/test/global/TestUtils.cpp @@ -0,0 +1,37 @@ +/* + barrier -- mouse and keyboard sharing utility + Copyright (C) Barrier contributors + + This package is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + found in the file LICENSE that should have accompanied this file. + + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include "TestUtils.h" +#include <random> + +namespace barrier { + +std::vector<std::uint8_t> generate_pseudo_random_bytes(std::size_t seed, std::size_t size) +{ + std::mt19937_64 engine{seed}; + std::uniform_int_distribution<int> dist{0, 255}; + std::vector<std::uint8_t> bytes; + + bytes.reserve(size); + for (std::size_t i = 0; i < size; ++i) { + bytes.push_back(dist(engine)); + } + + return bytes; +} + +} // namespace barrier diff --git a/src/test/global/TestUtils.h b/src/test/global/TestUtils.h new file mode 100644 index 0000000..31050ec --- /dev/null +++ b/src/test/global/TestUtils.h @@ -0,0 +1,30 @@ +/* + barrier -- mouse and keyboard sharing utility + Copyright (C) Barrier contributors + + This package is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + found in the file LICENSE that should have accompanied this file. + + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef BARRIER_TEST_GLOBAL_TEST_UTILS_H +#define BARRIER_TEST_GLOBAL_TEST_UTILS_H + +#include <cstdint> +#include <vector> + +namespace barrier { + +std::vector<std::uint8_t> generate_pseudo_random_bytes(std::size_t seed, std::size_t size); + +} // namespace barrier + +#endif // BARRIER_TEST_GLOBAL_TEST_UTILS_H diff --git a/src/test/global/gmock.h b/src/test/global/gmock.h index 64597f4..8a27440 100644 --- a/src/test/global/gmock.h +++ b/src/test/global/gmock.h @@ -1,11 +1,11 @@ /* * barrier -- mouse and keyboard sharing utility * Copyright (C) 2014-2016 Symless Ltd. - * + * * This package is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * found in the file LICENSE that should have accompanied this file. - * + * * This package is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/src/test/global/gtest.h b/src/test/global/gtest.h index 0b2acbc..55cb10f 100644 --- a/src/test/global/gtest.h +++ b/src/test/global/gtest.h @@ -1,11 +1,11 @@ /* * barrier -- mouse and keyboard sharing utility * Copyright (C) 2014-2016 Symless Ltd. - * + * * This package is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * found in the file LICENSE that should have accompanied this file. - * + * * This package is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
