Skip to content
Bitcoin Roots

v30.3-roots.1 · Commit 30: [PATCH 30/68] fix(release): close local gate findings

src/test/streams_tests.cpp

Before: src/test/streams_tests.cpp · After: src/test/streams_tests.cpp

File metadata
index 43d06a7d0bf5714fb257bfafa8358bdc93a3491f..468184ece9bbbaf2b0414ea1a402a6df5f958aa2 100644

Download original patch · Release notes

Diff rows 1–24 of 24. Line numbers refer to the original before/after files.

+ Added− RemovedUnmarked lines are context.

Scroll the code area horizontally to read long lines. The two line-number columns refer to before and after.

src/test/streams_tests.cpp CHANGED
@@ -87,6 +87,24 @@ BOOST_AUTO_TEST_CASE(obfuscation_empty)
87
87
  BOOST_CHECK(non_null_obf);
88
88
  }
89
89
 
90
+ BOOST_AUTO_TEST_CASE(autofile_empty_write)
91
+ {
92
+ const fs::path path{m_args.GetDataDirBase() / "empty_write.bin"};
93
+ const std::vector<std::byte> empty;
94
+ {
95
+ AutoFile file{fsbridge::fopen(path, "wb")};
96
+ file << std::span{empty};
97
+ file << std::byte{0x2a};
98
+ }
99
+ {
100
+ AutoFile file{fsbridge::fopen(path, "rb")};
101
+ std::byte value;
102
+ file >> value;
103
+ BOOST_CHECK_EQUAL(value, std::byte{0x2a});
104
+ BOOST_CHECK_EXCEPTION(file >> value, std::ios_base::failure, HasReason{"AutoFile::read: end of file"});
105
+ }
106
+ }
107
+
90
108
  BOOST_AUTO_TEST_CASE(xor_file)
91
109
  {
92
110
  fs::path xor_path{m_args.GetDataDirBase() / "test_xor.bin"};