From 7f9790092b24d1b279f65293675dc0d50af2d486 Mon Sep 17 00:00:00 2001 From: Jean-Sebastien Gelinas Date: Tue, 30 Jun 2009 09:27:48 -0400 Subject: [PATCH] tests: add test for filter_stream Signed-off-by: Jean-Sebastien Gelinas Signed-off-by: Jean Privat --- tests/sav/test_filterstream.sav | 5 +++++ tests/test_filterstream.nit | 40 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 tests/sav/test_filterstream.sav create mode 100644 tests/test_filterstream.nit diff --git a/tests/sav/test_filterstream.sav b/tests/sav/test_filterstream.sav new file mode 100644 index 0000000..743492c --- /dev/null +++ b/tests/sav/test_filterstream.sav @@ -0,0 +1,5 @@ +Hello World !! + +Hello World !! + + diff --git a/tests/test_filterstream.nit b/tests/test_filterstream.nit new file mode 100644 index 0000000..9faecb8 --- /dev/null +++ b/tests/test_filterstream.nit @@ -0,0 +1,40 @@ +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Copyright 2009 Jean-Sebastien Gelinas +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +import filter_stream + +var filename_1 = "test_filterstream_tmp1.write" +var filename_2 = "test_filterstream_tmp2.write" + +var output_file_1 = new OFStream.open(filename_1) +var output_file_2 = new OFStream.open(filename_2) + +var stream_demux = new StreamDemux(output_file_1, output_file_2) + +stream_demux.write("Hello World !!\n") +stream_demux.close + +var input_file_1 = new IFStream.open(filename_1) +var input_file_2 = new IFStream.open(filename_2) + +var stream_cat = new StreamCat(input_file_1,input_file_2) + +while not stream_cat.eof do + print stream_cat.read_line +end + +stream_cat.close -- 1.7.9.5