OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
OPAL
HashNameGeneratorTest.cpp
Go to the documentation of this file.
1 //
2 // Test HashNameGeneratorTest
3 //
4 // Copyright (c) 2010 - 2013, Yves Ineichen, ETH Zürich
5 // All rights reserved
6 //
7 // Implemented as part of the PhD thesis
8 // "Toward massively parallel multi-objective optimization with application to
9 // particle accelerators" (https://doi.org/10.3929/ethz-a-009792359)
10 //
11 // This file is part of OPAL.
12 //
13 // OPAL is free software: you can redistribute it and/or modify
14 // it under the terms of the GNU General Public License as published by
15 // the Free Software Foundation, either version 3 of the License, or
16 // (at your option) any later version.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with OPAL. If not, see <https://www.gnu.org/licenses/>.
20 //
22 #include "gtest/gtest.h"
23 #include <fstream>
24 
25 namespace {
26 
27  // The fixture for testing class Foo.
28  class HashNameGeneratorTest : public ::testing::Test {
29  protected:
30 
31  HashNameGeneratorTest() {
32  // You can do set-up work for each test here.
33  }
34 
35  virtual ~HashNameGeneratorTest() {
36  // You can do clean-up work that doesn't throw exceptions here.
37  }
38 
39  // If the constructor and destructor are not enough for setting up
40  // and cleaning up each test, you can define the following methods:
41 
42  virtual void SetUp() {
43  // Code here will be called immediately after the constructor (right
44  // before each test).
45  }
46 
47  virtual void TearDown() {
48  // Code here will be called immediately after each test (right
49  // before the destructor).
50  }
51  };
52 
53  TEST_F(HashNameGeneratorTest, HashName) {
54 
55  std::vector<std::string> params;
56  params.push_back("transferline");
57  params.push_back("sigmax=5.05");
58  params.push_back("sigmay=6.05");
59 
60  std::string hash = NativeHashGenerator::generate(params);
61  std::string expected = "88a02dc533c53bc156f54a4fcc54397b";
62  ASSERT_STREQ(expected.c_str(), hash.c_str());
63  }
64 
65 }
66 
67 int main(int argc, char **argv) {
68  ::testing::InitGoogleTest(&argc, argv);
69  return RUN_ALL_TESTS();
70 }
int main(int argc, char **argv)
static std::string generate(std::vector< std::string > arguments, size_t world_pid=0)