summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-05-02 19:31:50 +0200
committerCarl Hetherington <cth@carlh.net>2022-05-04 19:37:38 +0200
commit9a947571edec16a85830837b7b149e1ea2776bac (patch)
tree9c80f84227cfaec01315545ade0deed6ae87e16b /test
parent784020963f518aaba48b18b3fcff55d5c28a1f28 (diff)
C++11 tidying.
Diffstat (limited to 'test')
-rw-r--r--test/recovery_test.cc9
-rw-r--r--test/test.cc13
2 files changed, 11 insertions, 11 deletions
diff --git a/test/recovery_test.cc b/test/recovery_test.cc
index 62cb961a..43e5b93d 100644
--- a/test/recovery_test.cc
+++ b/test/recovery_test.cc
@@ -31,16 +31,19 @@
files in the program, then also delete it here.
*/
+
#include "mono_picture_asset_writer.h"
#include "mono_picture_asset.h"
#include "test.h"
#include <asdcp/KM_util.h>
-#include <boost/test/unit_test.hpp>
#include <boost/filesystem.hpp>
+#include <boost/test/unit_test.hpp>
+
-using std::string;
-using std::shared_ptr;
using std::make_shared;
+using std::shared_ptr;
+using std::string;
+
/** Check that recovery from a partially-written MXF works */
BOOST_AUTO_TEST_CASE (recovery)
diff --git a/test/test.cc b/test/test.cc
index e1a7e84e..b20678cd 100644
--- a/test/test.cc
+++ b/test/test.cc
@@ -217,19 +217,19 @@ check_file (boost::filesystem::path ref, boost::filesystem::path check)
BOOST_REQUIRE (check_file);
int const buffer_size = 65536;
- auto ref_buffer = new uint8_t[buffer_size];
- auto check_buffer = new uint8_t[buffer_size];
+ std::vector<uint8_t> ref_buffer(buffer_size);
+ std::vector<uint8_t> check_buffer(buffer_size);
uintmax_t pos = 0;
while (pos < size) {
uintmax_t this_time = min (uintmax_t(buffer_size), size - pos);
- size_t r = ref_file.read(ref_buffer, 1, this_time);
+ size_t r = ref_file.read(ref_buffer.data(), 1, this_time);
BOOST_CHECK_EQUAL (r, this_time);
- r = check_file.read(check_buffer, 1, this_time);
+ r = check_file.read(check_buffer.data(), 1, this_time);
BOOST_CHECK_EQUAL (r, this_time);
- if (memcmp(ref_buffer, check_buffer, this_time) != 0) {
+ if (memcmp(ref_buffer.data(), check_buffer.data(), this_time) != 0) {
for (int i = 0; i < buffer_size; ++i) {
if (ref_buffer[i] != check_buffer[i]) {
BOOST_CHECK_MESSAGE (
@@ -244,9 +244,6 @@ check_file (boost::filesystem::path ref, boost::filesystem::path check)
pos += this_time;
}
-
- delete[] ref_buffer;
- delete[] check_buffer;
}