File: CeilLogTest.cpp

package info (click to toggle)
cryfs 1.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 28,412 kB
  • sloc: cpp: 150,187; asm: 10,493; python: 1,455; javascript: 65; sh: 50; makefile: 17; xml: 7
file content (35 lines) | stat: -rw-r--r-- 691 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <gtest/gtest.h>
#include "blobstore/implementations/onblocks/utils/Math.h"

#include <limits>

using namespace blobstore::onblocks::utils;
using ::testing::Test;
using std::numeric_limits;

class CeilLogTest: public Test {};

TEST_F(CeilLogTest, Log3_1) {
 EXPECT_EQ(0, ceilLog(3, 1));
}

TEST_F(CeilLogTest, Log3_2) {
 EXPECT_EQ(1, ceilLog(3, 2));
}

TEST_F(CeilLogTest, Log3_3) {
 EXPECT_EQ(1, ceilLog(3, 3));
}

TEST_F(CeilLogTest, Log3_4) {
 EXPECT_EQ(2, ceilLog(3, 4));
}

TEST_F(CeilLogTest, 64bit) {
 const uint64_t value = UINT64_C(1024)*1024*1024*1024;
 EXPECT_GT(value, std::numeric_limits<uint32_t>::max());
 EXPECT_EQ(4u, ceilLog(UINT64_C(1024), value));
}


//TODO ...