/indra/newview/tests/llversioninfo_test.cpp
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 26#include "linden_common.h" 27 28#include "../test/lltut.h" 29 30#include "../llversioninfo.h" 31#include "llversionviewer.h" 32 33namespace tut 34{ 35 struct versioninfo 36 { 37 versioninfo() 38 : mResetChannel("Reset Channel") 39 { 40 std::ostringstream stream; 41 stream << LL_VERSION_MAJOR << "." 42 << LL_VERSION_MINOR << "." 43 << LL_VERSION_PATCH << "." 44 << LL_VERSION_BUILD; 45 mVersion = stream.str(); 46 stream.str(""); 47 48 stream << LL_VERSION_MAJOR << "." 49 << LL_VERSION_MINOR << "." 50 << LL_VERSION_PATCH; 51 mShortVersion = stream.str(); 52 stream.str(""); 53 54 stream << LL_CHANNEL 55 << " " 56 << mVersion; 57 mVersionAndChannel = stream.str(); 58 stream.str(""); 59 60 stream << mResetChannel 61 << " " 62 << mVersion; 63 mResetVersionAndChannel = stream.str(); 64 } 65 std::string mResetChannel; 66 std::string mVersion; 67 std::string mShortVersion; 68 std::string mVersionAndChannel; 69 std::string mResetVersionAndChannel; 70 }; 71 72 typedef test_group<versioninfo> versioninfo_t; 73 typedef versioninfo_t::object versioninfo_object_t; 74 tut::versioninfo_t tut_versioninfo("LLVersionInfo"); 75 76 template<> template<> 77 void versioninfo_object_t::test<1>() 78 { 79 ensure_equals("Major version", 80 LLVersionInfo::getMajor(), 81 LL_VERSION_MAJOR); 82 ensure_equals("Minor version", 83 LLVersionInfo::getMinor(), 84 LL_VERSION_MINOR); 85 ensure_equals("Patch version", 86 LLVersionInfo::getPatch(), 87 LL_VERSION_PATCH); 88 ensure_equals("Build version", 89 LLVersionInfo::getBuild(), 90 LL_VERSION_BUILD); 91 ensure_equals("Channel version", 92 LLVersionInfo::getChannel(), 93 LL_CHANNEL); 94 95 ensure_equals("Version String", 96 LLVersionInfo::getVersion(), 97 mVersion); 98 ensure_equals("Short Version String", 99 LLVersionInfo::getShortVersion(), 100 mShortVersion); 101 ensure_equals("Version and channel String", 102 LLVersionInfo::getChannelAndVersion(), 103 mVersionAndChannel); 104 105 LLVersionInfo::resetChannel(mResetChannel); 106 ensure_equals("Reset channel version", 107 LLVersionInfo::getChannel(), 108 mResetChannel); 109 110 ensure_equals("Reset Version and channel String", 111 LLVersionInfo::getChannelAndVersion(), 112 mResetVersionAndChannel); 113 } 114}