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

59 line
1.3 KiB

  1. //
  2. // Lol Engine
  3. //
  4. // Copyright: (c) 2010-2014 Sam Hocevar <sam@hocevar.net>
  5. // This program is free software; you can redistribute it and/or
  6. // modify it under the terms of the Do What The Fuck You Want To
  7. // Public License, Version 2, as published by Sam Hocevar. See
  8. // http://www.wtfpl.net/ for more details.
  9. //
  10. #if defined HAVE_CONFIG_H
  11. # include "config.h"
  12. #endif
  13. #include <lol/main.h>
  14. #include "lol/unit.h"
  15. namespace lol
  16. {
  17. LOLUNIT_FIXTURE(ArrayNDTest)
  18. {
  19. void SetUp() {}
  20. void TearDown() {}
  21. #if 0
  22. LOLUNIT_TEST(ArrayNDCreate)
  23. {
  24. arraynd<10, int> a;
  25. arraynd<20, float> b;
  26. arraynd<30, uint8_t> c;
  27. arraynd<40, double> d;
  28. }
  29. LOLUNIT_TEST(ArrayNDInit)
  30. {
  31. int const dimension = 8;
  32. vec_t<size_t, dimension> size;
  33. for (int i = 0; i < dimension; ++i)
  34. size[i] = 5;
  35. arraynd<dimension, uint8_t> a(size);
  36. memset(a.Data(), 0, a.Bytes());
  37. LOLUNIT_ASSERT_EQUAL(a[2][3][2][0][1][4][0][1], 0x00);
  38. vec_t<int, dimension> v{ 2, 3, 2, 0, 1, 4, 0, 1 };
  39. LOLUNIT_ASSERT_EQUAL(a[v], 0x00);
  40. a[2][3][2][0][1][4][0][1] = 0xcd;
  41. LOLUNIT_ASSERT_EQUAL(a[2][3][2][0][1][4][0][1], 0xcd);
  42. LOLUNIT_ASSERT_EQUAL(a[v], 0xcd);
  43. }
  44. #endif
  45. };
  46. } /* namespace lol */