PageRenderTime 39ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/newview/tests/llversioninfo_test.cpp

https://bitbucket.org/lindenlab/viewer-beta/
C++ | 114 lines | 78 code | 12 blank | 24 comment | 0 complexity | e8134d0cd13a1a8a2c494ae355464478 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llversioninfo_test.cpp
  3. *
  4. * $LicenseInfo:firstyear=2010&license=viewerlgpl$
  5. * Second Life Viewer Source Code
  6. * Copyright (C) 2010, Linden Research, Inc.
  7. *
  8. * This library is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU Lesser General Public
  10. * License as published by the Free Software Foundation;
  11. * version 2.1 of the License only.
  12. *
  13. * This library is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * Lesser General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with this library; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  21. *
  22. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  23. * $/LicenseInfo$
  24. */
  25. #include "linden_common.h"
  26. #include "../test/lltut.h"
  27. #include "../llversioninfo.h"
  28. #include "llversionviewer.h"
  29. namespace tut
  30. {
  31. struct versioninfo
  32. {
  33. versioninfo()
  34. : mResetChannel("Reset Channel")
  35. {
  36. std::ostringstream stream;
  37. stream << LL_VERSION_MAJOR << "."
  38. << LL_VERSION_MINOR << "."
  39. << LL_VERSION_PATCH << "."
  40. << LL_VERSION_BUILD;
  41. mVersion = stream.str();
  42. stream.str("");
  43. stream << LL_VERSION_MAJOR << "."
  44. << LL_VERSION_MINOR << "."
  45. << LL_VERSION_PATCH;
  46. mShortVersion = stream.str();
  47. stream.str("");
  48. stream << LL_CHANNEL
  49. << " "
  50. << mVersion;
  51. mVersionAndChannel = stream.str();
  52. stream.str("");
  53. stream << mResetChannel
  54. << " "
  55. << mVersion;
  56. mResetVersionAndChannel = stream.str();
  57. }
  58. std::string mResetChannel;
  59. std::string mVersion;
  60. std::string mShortVersion;
  61. std::string mVersionAndChannel;
  62. std::string mResetVersionAndChannel;
  63. };
  64. typedef test_group<versioninfo> versioninfo_t;
  65. typedef versioninfo_t::object versioninfo_object_t;
  66. tut::versioninfo_t tut_versioninfo("LLVersionInfo");
  67. template<> template<>
  68. void versioninfo_object_t::test<1>()
  69. {
  70. ensure_equals("Major version",
  71. LLVersionInfo::getMajor(),
  72. LL_VERSION_MAJOR);
  73. ensure_equals("Minor version",
  74. LLVersionInfo::getMinor(),
  75. LL_VERSION_MINOR);
  76. ensure_equals("Patch version",
  77. LLVersionInfo::getPatch(),
  78. LL_VERSION_PATCH);
  79. ensure_equals("Build version",
  80. LLVersionInfo::getBuild(),
  81. LL_VERSION_BUILD);
  82. ensure_equals("Channel version",
  83. LLVersionInfo::getChannel(),
  84. LL_CHANNEL);
  85. ensure_equals("Version String",
  86. LLVersionInfo::getVersion(),
  87. mVersion);
  88. ensure_equals("Short Version String",
  89. LLVersionInfo::getShortVersion(),
  90. mShortVersion);
  91. ensure_equals("Version and channel String",
  92. LLVersionInfo::getChannelAndVersion(),
  93. mVersionAndChannel);
  94. LLVersionInfo::resetChannel(mResetChannel);
  95. ensure_equals("Reset channel version",
  96. LLVersionInfo::getChannel(),
  97. mResetChannel);
  98. ensure_equals("Reset Version and channel String",
  99. LLVersionInfo::getChannelAndVersion(),
  100. mResetVersionAndChannel);
  101. }
  102. }