Skip to content

Commit

Permalink
Add more tests for issue #65, tests are passing though
Browse files Browse the repository at this point in the history
  • Loading branch information
josephjaspers committed Apr 27, 2020
1 parent b035502 commit 6ed9e59
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
5 changes: 5 additions & 0 deletions blackcat/allocators/basic_allocators.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ struct Basic_Allocator_Base
using value_type = ValueType;
using pointer = value_type*;
using const_pointer = value_type*;
#ifndef _MSC_VER
using size_type = std::size_t;
#else
//Custom allocators with signed types causes runtime exception inside of MSVC
using size_type = int;
#endif
using reference = value_type&;
using const_reference = const value_type&;
using propagate_on_container_copy_assignment = std::false_type;
Expand Down
2 changes: 1 addition & 1 deletion blackcat/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ using default_system_tag_t = BC_DEFAULT_SYSTEM_TAG;

// Visual Studio
#ifdef _MSC_VER
#define __PRETTY_FUNCTION__ __FUNCTION__
#define __PRETTY_FUNCTION__ __FUNCSIG__
#endif

#include <iostream>
Expand Down
8 changes: 3 additions & 5 deletions tests/test_algorithms.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ int test_algorithms(int sz=128) {
b.get_stream().sync();

return bc::tensors::all(a == 5) && bc::tensors::all(b == 7);
)
)

//TEST algo copy
//TEST algo copy
BC_TEST_DEF(
vec a(sz);
std::vector<value_type, allocator_type> b(sz);
Expand All @@ -84,9 +84,7 @@ int test_algorithms(int sz=128) {
host_b.push_back(i);
dyn_b.push_back(i);
}


bc::utility::Utility<system_tag>::copy(b.data(), host_b.data(), sz);
bc::utility::Utility<system_tag>::HostToDevice(b.data(), host_b.data(), sz);
bc::copy(a.get_stream(), b.begin(), b.end(), a.cw_begin());
return bc::tensors::all(a.approx_equal(dyn_b));
)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ static std::string sz60_test_buffer() {
} else { \
bc::print(sz80_substring("test success: "#__VA_ARGS__)); \
} \
} catch (...) { \
bc::print(sz80_substring("TEST ERROR: "#__VA_ARGS__)); \
} catch (std::exception &e) { \
bc::print(sz80_substring("TEST ERROR: " + std::string(e.what()) + #__VA_ARGS__)); \
bc_test_num_errors++; \
} \
}
Expand Down

0 comments on commit 6ed9e59

Please sign in to comment.