Skip to content

Commit 2ff8830

Browse files
committed
minor test improvements
1 parent 6b2c2f9 commit 2ff8830

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed

tests/stress/t.cpp

+75
Original file line numberDiff line numberDiff line change
@@ -16481,6 +16481,10 @@ void FreezeTest()
1648116481

1648216482
eq = bv.equal(bv_ro);
1648316483
assert(eq);
16484+
16485+
bv_ro.clear(true);
16486+
assert(!bv_ro.is_ro());
16487+
assert(bv_ro.count() == 0);
1648416488
}
1648516489

1648616490
// merge
@@ -37302,6 +37306,76 @@ int main(int argc, char *argv[])
3730237306
}
3730337307
*/
3730437308

37309+
/*
37310+
{
37311+
const string file_name = "/Users/anatoliykuznetsov/dev/git/BitMagic/tests/stress/HG_Ref_column.txt";
37312+
ifstream instr(file_name.c_str(), ios_base::in);
37313+
if (!instr.good() || !instr.is_open()) {
37314+
cout << "Failed to read file" << endl;
37315+
assert(0);
37316+
}
37317+
37318+
cout << "Reading " << file_name << endl;
37319+
using bvector_type = bm::bvector<>;
37320+
using TSparseStrVector = bm::str_sparse_vector<char, bvector_type, 390>;
37321+
TSparseStrVector ref(bm::use_null);
37322+
37323+
unsigned num_lines = 0;
37324+
{
37325+
auto start = chrono::steady_clock::now();
37326+
auto vec_it = ref.get_back_inserter();
37327+
string line;
37328+
37329+
while (getline(instr, line)) {
37330+
if (line.empty() || (!line.empty() && line[0] == '#')) {
37331+
continue;
37332+
}
37333+
++num_lines;
37334+
vec_it = line;
37335+
}
37336+
vec_it.flush();
37337+
auto diff = chrono::steady_clock::now() - start;
37338+
cout << "Reading took "
37339+
<< chrono::duration_cast<chrono::milliseconds>(diff).count() << " ms " << endl;
37340+
}
37341+
37342+
cout << "Lines: " << num_lines << ", " << ref.size() << endl;
37343+
{
37344+
cout << "Remapping..." << endl;
37345+
auto start = chrono::steady_clock::now();
37346+
ref.remap();
37347+
auto diff = chrono::steady_clock::now() - start;
37348+
cout << "Remap took "
37349+
<< chrono::duration_cast<chrono::milliseconds>(diff).count() << " ms " << endl;
37350+
}
37351+
{
37352+
cout << "Optimizing..." << endl;
37353+
auto start = chrono::steady_clock::now();
37354+
BM_DECLARE_TEMP_BLOCK(tb);
37355+
ref.optimize(tb);
37356+
auto diff = chrono::steady_clock::now() - start;
37357+
cout << "Optimization took "
37358+
<< chrono::duration_cast<chrono::milliseconds>(diff).count() << " ms " << endl;
37359+
}
37360+
37361+
using TLayout = bm::sparse_vector_serial_layout<TSparseStrVector>;
37362+
auto layout = make_unique<TLayout>();
37363+
37364+
bm::sparse_vector_serializer<TSparseStrVector> str_serializer;
37365+
37366+
str_serializer.set_bookmarks(true, 16);
37367+
str_serializer.enable_xor_compression();
37368+
assert(str_serializer.is_xor_ref());
37369+
{
37370+
cout << "Serializing..." << endl;
37371+
auto start = chrono::steady_clock::now();
37372+
str_serializer.serialize(ref, *layout.get());
37373+
auto diff = chrono::steady_clock::now() - start;
37374+
cout << "Serialization took "
37375+
<< chrono::duration_cast<chrono::milliseconds>(diff).count() << " ms " << endl;
37376+
}
37377+
}
37378+
*/
3730537379
//avx2_i32_shift();
3730637380
//return 0;
3730737381

@@ -37424,6 +37498,7 @@ int main(int argc, char *argv[])
3742437498

3742537499
if (is_all || is_bvbasic || is_bvb0)
3742637500
{
37501+
3742737502
ExportTest();
3742837503
CheckAllocLeaks(false);
3742937504

0 commit comments

Comments
 (0)