 package
 {
+    import com.kemsky.$;
     import com.kemsky.impl.Stream;
     import com.kemsky.impl.curry;
     import com.kemsky.impl.filters._;
+    import com.kemsky.impl.filters.add;
     import com.kemsky.impl.filters.eq;
     import com.kemsky.impl.filters.ge;
     import com.kemsky.impl.filters.gt;
-    import com.kemsky.$;
     import com.kemsky.impl.filters.prop;
     import com.kemsky.impl.filters.subtract;
-    import com.kemsky.impl.filters.add;
 
     import flash.utils.Dictionary;
 

            {
                return a + b + c;
            }
            var a:Function = curry(many, 1);
            assertEquals(a(1, 1), 3);


        }

        [Test]
        public function testCreateStream():void
        {
            var empty:Stream = $();
            assertEquals(empty.empty, true);
            assertEquals(empty.length, 0);


            var original:Array = [1, 2, 3];

            var array:Stream = $([1, 2, 3]);
            assertEquals(array.empty, false);
            assertEquals(array.length, 3);
            assertEquals(array.first, 1);
            assertEquals(array[0], 1);
            assertEquals(array[1], 2);
            assertEquals(array[2], 3);
            assertEquals(array.last, 3);
            verify(array, original);
            verify(array.array, original);
            verify(array.collection, original);
            verify(array.list, original);


            var collection:Stream = $(new ArrayCollection([1, 2, 3]));
            assertEquals(collection.empty, false);
            assertEquals(collection.length, 3);
            assertEquals(collection.first, 1);
            assertEquals(collection[0], 1);
            assertEquals(collection[1], 2);
            assertEquals(collection[2], 3);
            assertEquals(collection.last, 3);
            verify(collection, original);
            verify(collection.array, original);
            verify(collection.collection, original);
            verify(collection.list, original);


            var args:Stream = $(1, 2, 3);
            assertEquals(args.empty, false);
            assertEquals(args.length, 3);
            assertEquals(args.first, 1);
            assertEquals(args[0], 1);
            assertEquals(args[1], 2);
            assertEquals(args[2], 3);
            assertEquals(args.last, 3);
            verify(args, original);
            verify(args.array, original);
            verify(args.collection, original);
            verify(args.list, original);


            var single:Stream = $("item");
            assertEquals(single.empty, false);
            assertEquals(single.length, 1);
            assertEquals(single[0], "item");
            assertEquals(single.first, "item");
            assertEquals(single.last, "item");
            assertEquals(single.first, single.last);
        }

        private function verify(s:*, o:Array):void
        {
            var index:int = 0;
            for each (var item:* in s)
            {
                assertEquals(item, o[index]);
                index++;
            }
        }
    }
}
