File: C4StringTableTest.cpp

package info (click to toggle)
openclonk 8.1-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 169,656 kB
  • sloc: cpp: 180,484; ansic: 108,988; xml: 31,371; python: 1,223; php: 767; makefile: 148; sh: 101; javascript: 34
file content (52 lines) | stat: -rw-r--r-- 1,256 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
 * OpenClonk, http://www.openclonk.org
 *
 * Copyright (c) 2013, The OpenClonk Team and contributors
 *
 * Distributed under the terms of the ISC license; see accompanying file
 * "COPYING" for details.
 *
 * "Clonk" is a registered trademark of Matthes Bender, used with permission.
 * See accompanying file "TRADEMARK" for details.
 *
 * To redistribute this file separately, substitute the full license texts
 * for the above references.
 */

#include <C4Include.h>
#include "script/C4StringTable.h"

#include <gtest/gtest.h>

TEST(C4StringTableTest, SanityTests)
{
	EXPECT_FALSE(Strings.FindString("Apfelmus"));
	C4String * str = Strings.RegString("Apfelmus");
	ASSERT_TRUE(str);
	EXPECT_TRUE(Strings.FindString("Apfelmus"));
	str->IncRef();
	str->DecRef();
	EXPECT_FALSE(Strings.FindString("Apfelmus"));
}

class C4ValueNumbers;
class C4PropList;
class C4AulFunc;
class C4Object;
class C4ValueArray;
class C4Def;
class C4Effect;
struct C4AulParSet;
class C4AulScriptFunc;
#include "script/C4Value.h"

TEST(C4StringTableTest, ComparisonOperators)
{
	C4String * str1 = Strings.RegString("Käsebrot");
	C4String * str2 = Strings.RegString("Apfelmus");
	C4Value v1(str1);
	C4Value v2(str2);
	C4Value v3(str1);
	EXPECT_NE(v1, v2);
	EXPECT_EQ(v1, v3);
}