Changeset View
Changeset View
Standalone View
Standalone View
source/ps/tests/test_cppformat.h
/* Copyright (C) 2015 Wildfire Games. | /* Copyright (C) 2015 Wildfire Games. | ||||
elexis: 9 | |||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | ||||
* | * | ||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 0 A.D. is free software: you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | ||||
* (at your option) any later version. | * (at your option) any later version. | ||||
* | * | ||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | ||||
Show All 10 Lines | |||||
#include "third_party/cppformat/format.h" | #include "third_party/cppformat/format.h" | ||||
class TestCppformat : public CxxTest::TestSuite | class TestCppformat : public CxxTest::TestSuite | ||||
{ | { | ||||
public: | public: | ||||
void test_basic() | void test_basic() | ||||
{ | { | ||||
// Make test behave independent of current host locale | // Make test behave independent of current host locale | ||||
char* old = setlocale(LC_ALL, "en_US.UTF-8"); | char* old = setlocale(LC_ALL, NULL); | ||||
setlocale(LC_ALL, "en_US.UTF-8"); | |||||
TS_ASSERT_EQUALS(fmt::sprintf("abc"), "abc"); | TS_ASSERT_EQUALS(fmt::sprintf("abc"), "abc"); | ||||
TS_ASSERT_EQUALS(fmt::sprintf("%d", 123), "123"); | TS_ASSERT_EQUALS(fmt::sprintf("%d", 123), "123"); | ||||
TS_ASSERT_EQUALS(fmt::sprintf("%d", (int64_t)123), "123"); | TS_ASSERT_EQUALS(fmt::sprintf("%d", (int64_t)123), "123"); | ||||
TS_ASSERT_EQUALS(fmt::sprintf("%i", 123), "123"); | TS_ASSERT_EQUALS(fmt::sprintf("%i", 123), "123"); | ||||
TS_ASSERT_EQUALS(fmt::sprintf("%04x", 123), "007b"); | TS_ASSERT_EQUALS(fmt::sprintf("%04x", 123), "007b"); | ||||
Show All 27 Lines |
Wildfire Games · Phabricator
9