Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
romainthomas committed Dec 25, 2023
1 parent e13f2d5 commit 66fcfcc
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/unittests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ add_executable(unittests
test_utils.cpp
test_hash.cpp
test_binarystream.cpp
test_iostream.cpp
test_pe.cpp
test_elf.cpp
test_oat.cpp
Expand Down
32 changes: 32 additions & 0 deletions tests/unittests/test_iostream.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <catch2/catch_session.hpp>
#include <catch2/catch_test_macros.hpp>

#include "LIEF/span.hpp"
#include "LIEF/iostream.hpp"

TEST_CASE("lief.test.iostream", "[lief][test][iostream]") {
SECTION("Span") {
std::vector<uint8_t> buffer = {1, 2, 3, 4};
LIEF::span<uint8_t> span_buffer = buffer;

LIEF::vector_iostream ios;
ios.write(span_buffer);

REQUIRE(ios.raw() == buffer);
}
}

0 comments on commit 66fcfcc

Please sign in to comment.