Commit 474bb3ef authored by Paul Asmuth's avatar Paul Asmuth
Browse files

bring back FNV test, delete dead code

parent 729369d7
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -189,6 +189,10 @@ add_executable(tests/test-uri
    stage/src/fnordmetric/util/uri_test.cc)
target_link_libraries(tests/test-uri fnord-static)

add_executable(tests/test-fnv
    stage/src/fnordmetric/util/fnv_test.cc)
target_link_libraries(tests/test-fnv fnord-static)

add_executable(tests/test-csv-backend
    stage/src/fnordmetric/sql/backends/csv/csvbackend_test.cc)
target_link_libraries(tests/test-csv-backend fnord-static)
@@ -220,7 +224,3 @@ target_link_libraries(tests/test-statsd fnord-static)
add_executable(tests/test-disk-backend
    stage/src/fnordmetric/metricdb/backends/disk/diskbackend_test.cc)
target_link_libraries(tests/test-disk-backend fnord-static)

#add_executable(tests/test-metricrepository
#    stage/src/fnordmetric/metricdb/metricrepository_test.cc)
#target_link_libraries(tests/test-metricrepository fnord-static)
+0 −37
Original line number Diff line number Diff line
/**
 * This file is part of the "FnordMetric" project
 *   Copyright (c) 2014 Paul Asmuth, Google Inc.
 *
 * FnordMetric is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License v3.0. You should have received a
 * copy of the GNU General Public License along with this program. If not, see
 * <http://www.gnu.org/licenses/>.
 */
#include <fnordmetric/io/fileutil.h>
#include <fnordmetric/metricdb/metricrepository.h>
#include <fnordmetric/util/unittest.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

using namespace fnordmetric::metricdb;
using namespace fnord::io;

UNIT_TEST(MetricRepositoryTest);

const char kTestRepoPath[] = "/tmp/__fnordmetric_test_metricrepo";

TEST_CASE(MetricRepositoryTest, TestCreateNewMetric, [] () {
  io::FileUtil::mkdir_p(kTestRepoPath);

  MetricRepository repo(std::shared_ptr<FileRepository>(
      new FileRepository(kTestRepoPath)));

  EXPECT(repo.findMetric("http_status_codes") == nullptr);
  auto metric = repo.findOrCreateMetric("http_status_codes");
  EXPECT(metric != nullptr);
  EXPECT_EQ(metric->key(), "http_status_codes");
});


+0 −42
Original line number Diff line number Diff line
/**
 * This file is part of the "FnordMetric" project
 *   Copyright (c) 2014 Paul Asmuth, Google Inc.
 *
 * FnordMetric is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License v3.0. You should have received a
 * copy of the GNU General Public License along with this program. If not, see
 * <http://www.gnu.org/licenses/>.
 */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/fcntl.h>
#include <unistd.h>
#include "httpparser.h"

namespace fnordmetric {
namespace web {

class WebTest {
public:
  WebTest() {}

  void run() {
    testHTTPParser();
  }

  void testHTTPParser() {
    HTTPParser parser(HTTPParser::REQUEST);
    printf("testing!\n");
  }

};

}
}

int main() {
  fnordmetric::web::WebTest test;
  test.run();
  printf("all tests passed! :)\n");
}
+12 −13
Original line number Diff line number Diff line
/**
 * This file is part of the "FnordMetric" project
 *   Copyright (c) 2011-2014 Paul Asmuth, Google Inc.
 *   Copyright (c) 2014 Paul Asmuth, Google Inc.
 *
 * FnordMetric is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License v3.0. You should have received a
 * copy of the GNU General Public License along with this program. If not, see
 * <http://www.gnu.org/licenses/>.
 */

#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include "fnv.h"

void testSimpleHashing() {
  fnordmetric::FNV<uint64_t> fnv64;
  fnordmetric::FNV<uint32_t> fnv32;
#include <fnordmetric/util/fnv.h>
#include <fnordmetric/util/unittest.h>

  assert(fnv64.hash("fnord") == 0xE4D8CB6A3646310);
  assert(fnv32.hash("fnord") == 0x6D964EB0);
}
UNIT_TEST(FNVTest);

TEST_CASE(FNVTest, TestFNV64, [] () {
  fnord::util::FNV<uint64_t> fnv64;
  EXPECT_EQ(fnv64.hash("fnord"), 0xE4D8CB6A3646310);
});

int main() {
  testSimpleHashing();
}
TEST_CASE(FNVTest, TestFNV32, [] () {
  fnord::util::FNV<uint32_t> fnv32;
  EXPECT_EQ(fnv32.hash("fnord"), 0x6D964EB0);
});
+0 −1
Original line number Diff line number Diff line
@@ -9,7 +9,6 @@
    - make all the command in installation work
    - chart 2d/3d signature doc
    - all the doc links
    - better screenshot on homepage
    - page: included agents
    - finish http api 
    - group over doc: GROUP OVER TIMEWINDOW(time_window, step) oder so