mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-10-08 11:29:02 +00:00
4020f51988
As the RuntimeDeviceTracker is a per thread construct we now make it explicit that you can only get a reference to the per-thread version and can't copy it.
39 lines
1.4 KiB
C++
39 lines
1.4 KiB
C++
//============================================================================
|
|
// Copyright (c) Kitware, Inc.
|
|
// All rights reserved.
|
|
// See LICENSE.txt for details.
|
|
//
|
|
// 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>
|
|
#include <vtkm/cont/ErrorBadValue.h>
|
|
#include <vtkm/cont/Initialize.h>
|
|
#include <vtkm/cont/RuntimeDeviceInformation.h>
|
|
#include <vtkm/cont/RuntimeDeviceTracker.h>
|
|
|
|
//------------------------------------------------------------------------------
|
|
// This test ensures that exceptions thrown internally by the vtkm_cont library
|
|
// can be correctly caught across library boundaries.
|
|
int UnitTestExceptions(int argc, char* argv[])
|
|
{
|
|
vtkm::cont::Initialize(argc, argv);
|
|
auto& tracker = vtkm::cont::GetRuntimeDeviceTracker();
|
|
|
|
try
|
|
{
|
|
// This throws a ErrorBadValue from RuntimeDeviceTracker::CheckDevice,
|
|
// which is compiled into the vtkm_cont library:
|
|
tracker.ResetDevice(vtkm::cont::DeviceAdapterTagUndefined());
|
|
}
|
|
catch (vtkm::cont::ErrorBadValue&)
|
|
{
|
|
return EXIT_SUCCESS;
|
|
}
|
|
|
|
std::cerr << "Did not catch expected ErrorBadValue exception.\n";
|
|
return EXIT_FAILURE;
|
|
}
|