Browse Source

Removed a misplaced strategy

main
Ludovic 'Archivist' Lagouardette 2 years ago
parent
commit
2f011529b9
3 changed files with 12 additions and 14 deletions
  1. +2
    -0
      .gitattributes
  2. +0
    -12
      LibSnugLog/include/disruptor.h
  3. +10
    -2
      Tests/disruptor.cpp

+ 2
- 0
.gitattributes View File

@ -0,0 +1,2 @@
* text=auto eol=lf

+ 0
- 12
LibSnugLog/include/disruptor.h View File

@ -191,15 +191,3 @@ public:
return max_offset;
}
};
struct OverflowWait {
static constexpr overflow_response_t on_overflow = overflow_response_t::must_wait;
void wait() {
#if defined(__clang__) || defined(__GNUC__)
__asm__("nop\n\t");
#elif _MSC_VER
__nop;
#endif
}
};

+ 10
- 2
Tests/disruptor.cpp View File

@ -136,11 +136,19 @@ TEST_CASE("Disruptor works sequentially") {
}
TEST_CASE("Fails if buffer too small") {
REQUIRE_THROWS_AS(disruptor<OverflowWait>(nullptr, page_size), disruptor_exception);
REQUIRE_THROWS_AS(disruptor<strategy>(nullptr, page_size), disruptor_exception);
}
TEST_CASE("Fails if buffer size is 0") {
REQUIRE_THROWS_AS(disruptor<OverflowWait>(nullptr, 0), disruptor_exception);
REQUIRE_THROWS_AS(disruptor<strategy>(nullptr, 0), disruptor_exception);
}
TEST_CASE("Fails if buffer too small") {
REQUIRE_THROWS_AS(disruptor<strategy_that_overflows>(nullptr, page_size), disruptor_exception);
}
TEST_CASE("Fails if buffer size is 0") {
REQUIRE_THROWS_AS(disruptor<strategy_that_overflows>(nullptr, 0), disruptor_exception);
}
TEST_CASE("Disruptor works on overflow mode if things are not too contentious", "[long][unstable]") {

Loading…
Cancel
Save