2017-04-13 19:16:35 +00:00
|
|
|
//============================================================================
|
|
|
|
// Copyright (c) Kitware, Inc.
|
|
|
|
// All rights reserved.
|
|
|
|
// See LICENSE.txt for details.
|
2019-04-15 23:24:21 +00:00
|
|
|
//
|
2017-04-13 19:16:35 +00:00
|
|
|
// This software is distributed WITHOUT ANY WARRANTY; without even
|
|
|
|
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
// PURPOSE. See the above copyright notice for more information.
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
#include <vtkm/cont/Error.h>
|
2018-10-30 13:49:41 +00:00
|
|
|
#include <vtkm/cont/ErrorBadValue.h>
|
2019-01-01 22:19:02 +00:00
|
|
|
#include <vtkm/cont/Initialize.h>
|
2018-10-30 13:49:41 +00:00
|
|
|
#include <vtkm/cont/RuntimeDeviceInformation.h>
|
2017-04-13 19:16:35 +00:00
|
|
|
#include <vtkm/cont/RuntimeDeviceTracker.h>
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// This test ensures that exceptions thrown internally by the vtkm_cont library
|
|
|
|
// can be correctly caught across library boundaries.
|
2019-01-01 22:19:02 +00:00
|
|
|
int UnitTestExceptions(int argc, char* argv[])
|
2017-04-13 19:16:35 +00:00
|
|
|
{
|
2019-01-01 22:19:02 +00:00
|
|
|
vtkm::cont::Initialize(argc, argv);
|
2019-05-15 21:26:34 +00:00
|
|
|
auto& tracker = vtkm::cont::GetRuntimeDeviceTracker();
|
2017-04-13 19:16:35 +00:00
|
|
|
|
2017-05-18 14:29:41 +00:00
|
|
|
try
|
|
|
|
{
|
2017-04-13 19:16:35 +00:00
|
|
|
// This throws a ErrorBadValue from RuntimeDeviceTracker::CheckDevice,
|
|
|
|
// which is compiled into the vtkm_cont library:
|
2019-04-18 19:09:57 +00:00
|
|
|
tracker.ResetDevice(vtkm::cont::DeviceAdapterTagUndefined());
|
2017-04-13 19:16:35 +00:00
|
|
|
}
|
|
|
|
catch (vtkm::cont::ErrorBadValue&)
|
|
|
|
{
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::cerr << "Did not catch expected ErrorBadValue exception.\n";
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|