1 /** 2 For testing only. 3 Contains tests related to member privacy that cannot be verified inside 4 std.range itself. 5 */ 6 module std.internal.test.range; 7 8 // Note: currently can't be @safe because RefCounted, which is used by chunks, 9 // isn't. 10 @system /*@safe*/ unittest 11 { 12 import std.algorithm.comparison : equal; 13 import std.range : chunks; 14 15 struct R 16 { 17 int state = 0; emptyR18 @property bool empty() { return state >= 5; } frontR19 @property int front() { return state; } popFrontR20 void popFront() { state++; } 21 } 22 23 auto r = R().chunks(3); 24 assert(r.equal!equal([[ 0, 1, 2 ], [ 3, 4 ]])); 25 } 26