BufferTests.cpp 550 B

123456789101112131415161718192021
  1. #include "tests/BufferTests.h"
  2. #include "tests/Test.h"
  3. #include "utils/Buffer.h"
  4. static void testAdd(Test& test) {
  5. Buffer buffer(10);
  6. for(int i = 0; i < 100000; i++) {
  7. buffer.add(5);
  8. buffer.add(5L);
  9. buffer.add(5.0f);
  10. buffer.add(5.0);
  11. }
  12. test.checkEqual(static_cast<int> ((sizeof (int) + sizeof (long) + sizeof (float) + sizeof (double)) * 100000),
  13. buffer.getLength(), "add increments length");
  14. }
  15. void BufferTests::test() {
  16. Test test("Buffer");
  17. testAdd(test);
  18. test.finalize();
  19. }