text
stringlengths
0
2.2M
{
if (veryVerbose) {
cout << "\tTesting 'loadTimeZone'." << endl;
}
Obj mX(Z);
mX.configureRootPath(TEST_DIRECTORY);
bsl::string path(Z);
baltzo::Zoneinfo tz(Z); const baltzo::Zoneinfo& TZ = tz;
ASSERT(0 != mX.loadTimeZone(&tz, "FOO"));
ASSERT(0 == mX.loadTimeZone(&tz, "America/New_York"));
ASSERT("America/New_York" == TZ.identifier());
if (veryVeryVerbose) {
TZ.print(bsl::cout, 1, 3);
}
}
} break;
default: {
cerr << "WARNING: CASE `" << test << "' NOT FOUND." << endl;
testStatus = -1;
}
}
if (testStatus > 0) {
cerr << "Error, non-zero test status = " << testStatus << "." << endl;
}
ASSERT(0 == FUtil::setWorkingDirectory(origWorkingDirectory));
LOOP_ASSERT(tmpWorkingDir, FUtil::exists(tmpWorkingDir));
// Sometimes this delete won't work because of '.nfs*' gremlin files that
// mysteriously get created in the directory. Seems to especially happen
// in TC 5 for some reason. Leave the directory behind and move on. Also
// remove twice, because sometimes the first 'remove' 'sorta' fails -- it
// returns a negative status after successfully killing the gremlin file.
// Worst case, leave the file there to be cleaned up in a sweep later.
int ii;
for (ii = 1; ii < 12; ++ii) {
if (veryVerbose) {
cout << "Cleaning up " << tmpWorkingDir << " (attempt " << ii <<
")" << endl;
}
FUtil::remove(tmpWorkingDir, true);
if (!FUtil::exists(tmpWorkingDir)) {
if (veryVerbose) {
cout << "Clean up of " << tmpWorkingDir << " succeeded"
<< endl;
}
break;
}
u::sleep(10);
}
ASSERTV(tmpWorkingDir, !FUtil::exists(tmpWorkingDir) &&
"unable to clean 'tmpWorkingDir'");
return testStatus;
}
// ----------------------------------------------------------------------------
// Copyright 2018 Bloomberg Finance L.P.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------- END-OF-FILE ----------------------------------
#include <c10/util/Array.h>
#include <gtest/gtest.h>
using c10::guts::array;
using c10::guts::to_array;
namespace {
namespace test_equals {
static_assert(array<int, 0>{{}} == array<int, 0>{{}}, "");
static_assert(array<int, 3>{{2, 3, 4}} == array<int, 3>{{2, 3, 4}}, "");
static_assert(!(array<int, 3>{{2, 3, 4}} == array<int, 3>{{1, 3, 4}}), "");
static_assert(!(array<int, 3>{{2, 3, 4}} == array<int, 3>{{2, 1, 4}}), "");
static_assert(!(array<int, 3>{{2, 3, 4}} == array<int, 3>{{2, 3, 1}}), "");
} // namespace test_equals
namespace test_notequals {
static_assert(!(array<int, 0>{{}} != array<int, 0>{{}}), "");