yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
7b570feed
master
1// unit-test-path.cpp 2 3#include "core/slang-basic.h" 4#include "core/slang-chunked-list.h" 5#include "unit-test/slang-unit-test.h" 6 7using namespace Slang ; 8 9template < typename T > 10static bool _checkArrayView (ArrayView < T > v0 ,ArrayView < T > v1 ) 11{ 12if (v0 .getCount ()!= v1 .getCount ()) 13return false; 14for (Index i = 0 ;i < v0 .getCount ();i ++ ) 15if (v0 [i ]!= v1 [i ]) 16return false; 17return true; 18} 19 20SLANG_UNIT_TEST (chunkedList ) 21{ 22 { 23ChunkedList < String > stringList ; 24List < String *> ptrs ; 25for (int i = 0 ;i < 256 ;i ++ ) 26 { 27ptrs .add (stringList .add (String (i ))); 28 } 29SLANG_CHECK (stringList .getCount ()== 256 ); 30SLANG_CHECK (* (ptrs [128 ])== "128" ); 31 32stringList .clearAndDeallocate (); 33ptrs .clear (); 34for (int i = 0 ;i < 64 ;i ++ ) 35 { 36ptrs .add (stringList .add (String (i ))); 37 } 38SLANG_CHECK (stringList .getCount ()== 64 ); 39SLANG_CHECK (* (ptrs [32 ])== "32" ); 40 } 41}