aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/global
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/global')
-rw-r--r--src/test/global/TestEventQueue.cpp6
-rw-r--r--src/test/global/TestEventQueue.h4
-rw-r--r--src/test/global/TestUtils.cpp37
-rw-r--r--src/test/global/TestUtils.h30
-rw-r--r--src/test/global/gmock.h4
-rw-r--r--src/test/global/gtest.h4
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