You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

device.cpp 787 B

1234567891011121314151617181920212223242526272829303132
  1. #include "megcore.h"
  2. #include <gtest/gtest.h>
  3. #include "test/common/utils.h"
  4. TEST(MegcoreCPU, DEVICE) {
  5. megcoreDeviceHandle_t handle;
  6. megcoreCreateDeviceHandle(&handle, megcorePlatformCPU, -1, 0);
  7. int deviceID;
  8. megcoreGetDeviceID(handle, &deviceID);
  9. ASSERT_EQ(-1, deviceID);
  10. megcorePlatform_t platform;
  11. megcoreGetPlatform(handle, &platform);
  12. ASSERT_EQ(megcorePlatformCPU, platform);
  13. unsigned int flags;
  14. megcoreGetDeviceFlags(handle, &flags);
  15. ASSERT_EQ(0u, flags);
  16. size_t memAlignmentInBytes;
  17. megcoreGetMemAlignment(handle, &memAlignmentInBytes);
  18. megcoreActivate(handle);
  19. void* ptr;
  20. megcoreMalloc(handle, &ptr, 256);
  21. megcoreFree(handle, ptr);
  22. megcoreDestroyDeviceHandle(handle);
  23. }
  24. // vim: syntax=cpp.doxygen