Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add tests for tesh sorting and filtering of ouptut.
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Wed, 5 Oct 2011 07:03:51 +0000 (09:03 +0200)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Wed, 5 Oct 2011 09:41:20 +0000 (11:41 +0200)
buildtools/Cmake/AddTests.cmake
tools/tesh/basic.tesh
tools/tesh/basic2.tesh [new file with mode: 0644]

index 4989ffd..06b05c2 100644 (file)
@@ -24,7 +24,7 @@ INCLUDE(CTest)
 ENABLE_TESTING()
 
 if(NOT enable_memcheck)
-ADD_TEST(tesh-self-basic               ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cd "${CMAKE_HOME_DIRECTORY}/tools/tesh" basic.tesh)
+ADD_TEST(tesh-self-basic               ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --setenv bindir=${CMAKE_BINARY_DIR}/bin --cd "${CMAKE_HOME_DIRECTORY}/tools/tesh" basic.tesh)
 ADD_TEST(tesh-self-cd                  ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cd "${CMAKE_BINARY_DIR}/bin" ${CMAKE_HOME_DIRECTORY}/tools/tesh/cd.tesh)
 ADD_TEST(tesh-self-IO-broken-pipe      ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cd "${CMAKE_HOME_DIRECTORY}/tools/tesh" IO-broken-pipe.tesh)
 ADD_TEST(tesh-self-IO-orders           ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cd "${CMAKE_BINARY_DIR}/bin" ${CMAKE_HOME_DIRECTORY}/tools/tesh/IO-orders.tesh)
index fd7de37..d26a68e 100644 (file)
@@ -29,3 +29,17 @@ $ wc -l tmp_fich
 > 4 tmp_fich
 
 $ rm tmp_fich
+
+$ ${bindir:=.}/tesh --enable-coverage --log='log.thresh:info tesh.fmt:%m%n' basic2.tesh
+> Enable coverage
+> Test suite `basic2'
+> [basic2:3] Test sorting and filtering of output
+> [basic2:5] printf 'a\\nb\\nc\\nd\\n'
+> [basic2:11] printf 'a\\nb\\nc\\nd'
+> [basic2:18] printf 'c\\nd\\nb\\na\\n'
+> [basic2:25] printf 'c\\nd\\nb\\na'
+> [basic2:31] printf 'a\\nprofiling: foo\\nprofiling: bar\\nb\\nc\\nd\\nprofiling: baz\\n'
+> [basic2:37] printf 'a\\nprofiling: foo\\nprofiling: bar\\nb\\nc\\nd\\nprofiling: baz'
+> [basic2:44] printf 'c\\nprofiling: foo\\nprofiling: bar\\nd\\nb\\na\\nprofiling: baz\\n'
+> [basic2:51] printf 'c\\nprofiling: foo\\nprofiling: bar\\nd\\nb\\na\\nprofiling: baz'
+> Test suite `basic2' OK
diff --git a/tools/tesh/basic2.tesh b/tools/tesh/basic2.tesh
new file mode 100644 (file)
index 0000000..9e08b11
--- /dev/null
@@ -0,0 +1,55 @@
+#! ./tesh
+
+p Test sorting and filtering of output
+
+$ printf 'a\\nb\\nc\\nd\\n'
+> a
+> b
+> c
+> d
+
+$ printf 'a\\nb\\nc\\nd'
+> a
+> b
+> c
+> d
+
+! output sort
+$ printf 'c\\nd\\nb\\na\\n'
+> a
+> b
+> c
+> d
+
+! output sort
+$ printf 'c\\nd\\nb\\na'
+> a
+> b
+> c
+> d
+
+$ printf 'a\\nprofiling: foo\\nprofiling: bar\\nb\\nc\\nd\\nprofiling: baz\\n'
+> a
+> b
+> c
+> d
+
+$ printf 'a\\nprofiling: foo\\nprofiling: bar\\nb\\nc\\nd\\nprofiling: baz'
+> a
+> b
+> c
+> d
+
+! output sort
+$ printf 'c\\nprofiling: foo\\nprofiling: bar\\nd\\nb\\na\\nprofiling: baz\\n'
+> a
+> b
+> c
+> d
+
+! output sort
+$ printf 'c\\nprofiling: foo\\nprofiling: bar\\nd\\nb\\na\\nprofiling: baz'
+> a
+> b
+> c
+> d