[cosmetics] update date in GPL header
[vuplus_xbmc] / xbmc / utils / test / TestStdString.cpp
1 /*
2  *      Copyright (C) 2005-2013 Team XBMC
3  *      http://www.xbmc.org
4  *
5  *  This Program is free software; you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation; either version 2, or (at your option)
8  *  any later version.
9  *
10  *  This Program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with XBMC; see the file COPYING.  If not, see
17  *  <http://www.gnu.org/licenses/>.
18  *
19  */
20
21 #include "utils/StdString.h"
22
23 #include "gtest/gtest.h"
24
25 TEST(TestStdString, CStdString)
26 {
27   CStdString ref, var;
28
29   ref = "CStdString test";
30   var = ref;
31   EXPECT_STREQ(ref.c_str(), var.c_str());
32 }
33
34 TEST(TestStdString, CStdStringA)
35 {
36   CStdStringA ref, var;
37
38   ref = "CStdStringA test";
39   var = ref;
40   EXPECT_STREQ(ref.c_str(), var.c_str());
41 }
42
43 TEST(TestStdString, CStdStringW)
44 {
45   CStdStringW ref, var;
46
47   ref = L"CStdStringW test";
48   var = ref;
49   EXPECT_STREQ(ref.c_str(), var.c_str());
50 }
51
52 TEST(TestStdString, CStdString16)
53 {
54   CStdString16 ref, var;
55
56   ref = (uint16_t*)"CStdString16 test";
57   var = ref;
58   EXPECT_TRUE(!memcmp(ref.c_str(), var.c_str(),
59                       ref.length() * sizeof(uint16_t)));
60 }
61
62 TEST(TestStdString, CStdString32)
63 {
64   CStdString32 ref, var;
65
66   ref = (uint32_t*)"CStdString32 test";
67   var = ref;
68   EXPECT_TRUE(!memcmp(ref.c_str(), var.c_str(),
69                       ref.length() * sizeof(uint32_t)));
70 }
71
72 TEST(TestStdString, CStdStringO)
73 {
74   CStdStringO ref, var;
75
76   ref = "CStdString32 test";
77   var = ref;
78   EXPECT_TRUE(!memcmp(ref.c_str(), var.c_str(),
79                       ref.length() * sizeof(OLECHAR)));
80 }