test_cnversion.cpp 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*************************************************************************
  2. * Copyright (C) [2019] by Cambricon, Inc. All rights reserved
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * The above copyright notice and this permission notice shall be included in
  11. * all copies or substantial portions of the Software.
  12. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  13. * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  15. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  18. * THE SOFTWARE.
  19. *************************************************************************/
  20. #include <gtest/gtest.h>
  21. #include <cstdio>
  22. #include <cstring>
  23. #include <sstream>
  24. #include <string>
  25. #include "cnstream_version.hpp"
  26. #define VERSION_STRING_LENGTH 10
  27. #define MAJOR_VERSION 4
  28. #define MINOR_VERSION 0
  29. #define PATCH_VERSION 0
  30. namespace cnstream {
  31. TEST(CoreCnVersion, GetVersion) {
  32. EXPECT_GE(MajorVersion(), 0);
  33. EXPECT_GE(MinorVersion(), 0);
  34. EXPECT_GE(PatchVersion(), 0);
  35. auto version = VersionString();
  36. std::string ver_str = "v" + std::to_string(CNSTREAM_MAJOR_VERSION) + "." + std::to_string(CNSTREAM_MINOR_VERSION) +
  37. "." + std::to_string(CNSTREAM_PATCH_VERSION);
  38. EXPECT_STREQ(version, ver_str.c_str());
  39. // EXPECT_STREQ(version, "v4.5.0");
  40. }
  41. } // namespace cnstream