@@ -24,19 +24,30 @@ extern "C" {
2424#include < vector>
2525#include < cstring>
2626#include < filesystem>
27+ #if defined(__cpp_lib_format)
28+ #include < format>
29+ #else
30+ // Sigh!! gcc11 does not support std::format though it has a g++20 option.
31+ // Use {fmt} instead.
32+ #include < fmt/ostream.h>
33+ #endif
2734
2835#include " basisu_c_binding.h"
2936
30- using namespace std ;
37+ namespace {
38+
3139namespace fs = std::filesystem;
40+ #if defined(__cpp_lib_format)
41+ using namespace std ;
42+ #else
43+ using namespace fmt ;
44+ #endif
3245
3346fs::path basisResources, ktxResources;
3447
35- namespace {
36-
3748typedef struct {
38- string ktxFile;
39- string basisuFile;
49+ std:: string ktxFile;
50+ std:: string basisuFile;
4051 bool isPo2;
4152 bool hasAlpha;
4253} TextureSet;
@@ -57,15 +68,15 @@ std::ostream& operator<<(std::ostream& out, const FormatFeature& h)
5768 return out << ktxTranscodeFormatString (h.format );
5869}
5970
60- vector<TextureSet> allTextureSets = {
71+ std:: vector<TextureSet> allTextureSets = {
6172 {" color_grid_blze.ktx2" ," color_grid.basis" ,true ,false },
6273#if 1
6374 {" kodim17_blze.ktx2" ," kodim17.basis" ,false ,false },
6475 {" alpha_simple_blze.ktx2" ," alpha_simple.basis" ,true ,true }
6576#endif
6677};
6778
68- vector<FormatFeature> allFormats = {
79+ std:: vector<FormatFeature> allFormats = {
6980#if 1
7081 {KTX_TTF_ETC1_RGB,true ,true },
7182 {KTX_TTF_ETC2_RGBA,true ,true },
@@ -91,15 +102,15 @@ vector<FormatFeature> allFormats = {
91102};
92103
93104class TextureCombinationsTest :
94- public ::testing::TestWithParam<tuple<TextureSet,FormatFeature>> {};
105+ public ::testing::TestWithParam<std:: tuple<TextureSet,FormatFeature>> {};
95106
96107INSTANTIATE_TEST_SUITE_P (AllCombinations,
97108 TextureCombinationsTest,
98109 ::testing::Combine (::testing::ValuesIn(allTextureSets),
99110 ::testing::ValuesIn(allFormats)));
100111
101112bool read_file ( fs::path file, void ** data, unsigned long *fsize ) {
102- FILE *f = fopenUTF8 (file.u8string (), string (" rb" ));
113+ FILE *f = fopenUTF8 (file.u8string (), std:: string (" rb" ));
103114 if (f==NULL ) {
104115 return false ;
105116 }
@@ -211,7 +222,7 @@ int main(int argc, char **argv) {
211222
212223 if (!::testing::FLAGS_gtest_list_tests) {
213224 if (argc != 2 ) {
214- cerr << " Usage: " << argv[0 ] << " <test resources path>\n " ;
225+ std:: cerr << " Usage: " << argv[0 ] << " <test resources path>\n " ;
215226 return -1 ;
216227 }
217228
0 commit comments