1 /* 2 * Copyright 2022 Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Leorize, leorize+oss@disroot.org 7 */ 8 #ifndef _MEMORY_RING_IO_TEST_H 9 #define _MEMORY_RING_IO_TEST_H 10 11 12 #include <ThreadedTestCase.h> 13 #include <MemoryRingIO.h> 14 15 class BTestSuite; 16 17 18 class MemoryRingIOTest : public BThreadedTestCase 19 { 20 public: 21 MemoryRingIOTest(size_t bufferSize) : fRing(bufferSize) {}; 22 23 void WriteTest(); 24 void ReadTest(); 25 void BusyWriterTest(); 26 void BusyReaderTest(); 27 void ReadWriteSingleTest(); 28 void InvalidResizeTest(); 29 void TimeoutTest(); 30 31 static void AddTests(BTestSuite& parent); 32 33 34 protected: 35 void _DisableWriteOnFullBuffer(); 36 void _DisableWriteOnEmptyBuffer(); 37 38 BMemoryRingIO fRing; 39 }; 40 41 #endif // _MEMORY_RING_IO_TEST_H 42