diff options
| author | Yong He <yonghe@outlook.com> | 2022-02-09 15:30:38 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-09 15:30:38 -0800 |
| commit | b8982fcf43b86c1e39dcc3dd19bff2821633eda6 (patch) | |
| tree | 0d66dbf46b50e760cce4aee232bd6a020976e6fb /tools/slang-unit-test/unit-test-chunked-list.cpp | |
| parent | 59f3fdc0a372d19ce4e989514ee3e9ecbcbf234c (diff) | |
Various fixes to gfx. (#2120)
* Various fixes to gfx.
* Fix.
* Fixes.
* Fix.
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tools/slang-unit-test/unit-test-chunked-list.cpp')
| -rw-r--r-- | tools/slang-unit-test/unit-test-chunked-list.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/tools/slang-unit-test/unit-test-chunked-list.cpp b/tools/slang-unit-test/unit-test-chunked-list.cpp new file mode 100644 index 000000000..af4f597b2 --- /dev/null +++ b/tools/slang-unit-test/unit-test-chunked-list.cpp @@ -0,0 +1,41 @@ +// unit-test-path.cpp + +#include "source/core/slang-basic.h" +#include "source/core/slang-chunked-list.h" +#include "tools/unit-test/slang-unit-test.h" + +using namespace Slang; + +template<typename T> +static bool _checkArrayView(ArrayView<T> v0, ArrayView<T> v1) +{ + if (v0.getCount() != v1.getCount()) + return false; + for (Index i = 0; i < v0.getCount(); i++) + if (v0[i] != v1[i]) + return false; + return true; +} + +SLANG_UNIT_TEST(chunkedList) +{ + { + ChunkedList<String> stringList; + List<String*> ptrs; + for (int i = 0; i < 256; i++) + { + ptrs.add(stringList.add(String(i))); + } + SLANG_CHECK(stringList.getCount() == 256); + SLANG_CHECK(*(ptrs[128]) == "128"); + + stringList.clearAndDeallocate(); + ptrs.clear(); + for (int i = 0; i < 64; i++) + { + ptrs.add(stringList.add(String(i))); + } + SLANG_CHECK(stringList.getCount() == 64); + SLANG_CHECK(*(ptrs[32]) == "32"); + } +} |
