|
2 | 2 |
|
3 | 3 | #include <cstddef> |
4 | 4 | #include <cstdint> |
5 | | -#include <iostream> |
6 | 5 | #include <memory> |
7 | 6 | #include <vector> |
8 | 7 |
|
9 | 8 | #include "all/example/include/ops_all.hpp" |
10 | 9 | #include "core/task/include/task.hpp" |
11 | 10 | #include "core/util/include/util.hpp" |
12 | | -#define STB_IMAGE_IMPLEMENTATION |
13 | | -#include <stb/stb_image.h> |
14 | 11 |
|
| 12 | +#include <stb_library.hpp> |
15 | 13 | #include <string> |
16 | 14 |
|
17 | 15 | TEST(nesterov_a_test_task_all, test_matmul_50) { |
@@ -45,20 +43,11 @@ TEST(nesterov_a_test_task_all, test_matmul_from_pic) { |
45 | 43 | int width = -1; |
46 | 44 | int height = -1; |
47 | 45 | int channels = -1; |
48 | | - std::vector<uint8_t> img; |
49 | 46 | std::string abs_path = ppc::util::GetAbsolutePath("all/example/data/pic_all.jpg"); |
50 | | - |
51 | | - auto get_image_data = [&]() -> bool { |
52 | | - unsigned char *data = stbi_load(abs_path.c_str(), &width, &height, &channels, 0); |
53 | | - if (data == nullptr) { |
54 | | - std::cerr << "Failed to load image: " << stbi_failure_reason() << '\n'; |
55 | | - return false; |
56 | | - } |
57 | | - img = std::vector<uint8_t>(data, data + (width * height * channels)); |
58 | | - stbi_image_free(data); |
59 | | - return true; |
60 | | - }; |
61 | | - EXPECT_TRUE(get_image_data()); |
| 47 | + unsigned char *data = stbi_load(abs_path.c_str(), &width, &height, &channels, 0); |
| 48 | + EXPECT_TRUE(data != nullptr) << "Failed to load image: " << stbi_failure_reason() << '\n'; |
| 49 | + std::vector<uint8_t> img = std::vector<uint8_t>(data, data + (width * height * channels)); |
| 50 | + stbi_image_free(data); |
62 | 51 |
|
63 | 52 | EXPECT_EQ(width, height); |
64 | 53 | const int count = (width + height) / 10; |
|
0 commit comments