From 3eb2ba91a4bc39733d1e03ee32ec7f2aa9bf439a Mon Sep 17 00:00:00 2001 From: Minh Hiep Pham <minh.pham@telecom-paristech.fr> Date: Wed, 30 Jan 2019 12:05:27 +0100 Subject: [PATCH] change the context in tml file test --- .../java/tmltranslator/CompareTMLTests.java | 18 +++++++++++ .../resources/tmltranslator/input/file1.tml | 5 +++ .../resources/tmltranslator/input/file2.tml | 6 +++- .../resources/tmltranslator/input/file3.tml | 7 +++- .../resources/tmltranslator/input/file4.tml | 12 ++++++- .../resources/tmltranslator/input/file5.tml | 16 ++++++++-- .../resources/tmltranslator/input/file6.tml | 20 +++++++++--- .../resources/tmltranslator/input/file7.tml | 32 +++++++++++++++++-- 8 files changed, 104 insertions(+), 12 deletions(-) diff --git a/ttool/src/test/java/tmltranslator/CompareTMLTests.java b/ttool/src/test/java/tmltranslator/CompareTMLTests.java index 4467028120..a0c7b26882 100644 --- a/ttool/src/test/java/tmltranslator/CompareTMLTests.java +++ b/ttool/src/test/java/tmltranslator/CompareTMLTests.java @@ -23,9 +23,14 @@ public class CompareTMLTests { final static String COMMENT_AND_CONTEXT_4 = PATH_TO_TEST_COMPARE_FILE + "file7.tml"; + // Test true cases @Test public void onlyCommentAndEmptyTest () throws Exception { CompareTML ctml = new CompareTML(); + /* file 1 and file 2 + * file 1 includes only blank lines + * file 2 includes only comments + */ assertTrue("comparing between empty file and another file including only comment",ctml.compareTML(new File(EMPTY_FILE), new File(ONLY_COMMENT_1))); } @@ -33,6 +38,9 @@ public class CompareTMLTests { @Test public void onlyCommentAndOnlyComment () throws Exception { CompareTML ctml = new CompareTML(); + /* file 2 and file 3 + * file 2 and file 3 include only comments and blank lines + */ assertTrue("comparing between 2 files including only comment",ctml.compareTML(new File(ONLY_COMMENT_1), new File(ONLY_COMMENT_2))); } @@ -40,13 +48,20 @@ public class CompareTMLTests { @Test public void sameContextDifferentComment () throws Exception { CompareTML ctml = new CompareTML(); + /* file 4 and file 5 + * two files includes many comments, blank lines and white spaces before and after strings (comments or context) + */ assertTrue("comparing between 2 files including the same context but different comment",ctml.compareTML(new File(COMMENT_AND_CONTEXT_1), new File(COMMENT_AND_CONTEXT_2))); } + // Test false cases @Test public void DifferentContextDifferentComment () throws Exception { CompareTML ctml = new CompareTML(); + /* file 5 and file 6 + * adding white spaces between two words in file 6 in comparison with file 5 + */ assertFalse("comparing between 2 files including the same context but different comment",ctml.compareTML(new File(COMMENT_AND_CONTEXT_2), new File(COMMENT_AND_CONTEXT_3))); } @@ -54,6 +69,9 @@ public class CompareTMLTests { @Test public void DifferentContextSameComment () throws Exception { CompareTML ctml = new CompareTML(); + /* file 6 and file 7 + * adding context in file 7 in comparison with file 6 + */ assertFalse("comparing between 2 files including the same comment but different context", ctml.compareTML(new File(COMMENT_AND_CONTEXT_3), new File(COMMENT_AND_CONTEXT_4))); diff --git a/ttool/src/test/resources/tmltranslator/input/file1.tml b/ttool/src/test/resources/tmltranslator/input/file1.tml index e69de29bb2..3f2ff2d6cc 100644 --- a/ttool/src/test/resources/tmltranslator/input/file1.tml +++ b/ttool/src/test/resources/tmltranslator/input/file1.tml @@ -0,0 +1,5 @@ + + + + + diff --git a/ttool/src/test/resources/tmltranslator/input/file2.tml b/ttool/src/test/resources/tmltranslator/input/file2.tml index f8bba761c0..a7caaedad1 100644 --- a/ttool/src/test/resources/tmltranslator/input/file2.tml +++ b/ttool/src/test/resources/tmltranslator/input/file2.tml @@ -1 +1,5 @@ -// comment 1 \ No newline at end of file +// comment 1 + + +// todo1 + diff --git a/ttool/src/test/resources/tmltranslator/input/file3.tml b/ttool/src/test/resources/tmltranslator/input/file3.tml index 01294e4cb7..f197c765e8 100644 --- a/ttool/src/test/resources/tmltranslator/input/file3.tml +++ b/ttool/src/test/resources/tmltranslator/input/file3.tml @@ -1 +1,6 @@ -// comment 2 \ No newline at end of file +// comment 2 + // todo1 + + +// todo2 + diff --git a/ttool/src/test/resources/tmltranslator/input/file4.tml b/ttool/src/test/resources/tmltranslator/input/file4.tml index 9d5f5aa294..c5ff371547 100644 --- a/ttool/src/test/resources/tmltranslator/input/file4.tml +++ b/ttool/src/test/resources/tmltranslator/input/file4.tml @@ -1,4 +1,14 @@ // File with comment + context 1 // Channels CHANNEL DIPLODOCUS_C_Design__channel BRBW 4 8 OUT DIPLODOCUS_C_Design__PrimitiveComp1 IN DIPLODOCUS_C_Design__PrimitiveComp2 -CHANNEL DIPLODOCUS_C_Design__channel_0 BRBW 4 8 OUT DIPLODOCUS_C_Design__PrimitiveComp1_0 IN DIPLODOCUS_C_Design__PrimitiveComp2_0 \ No newline at end of file + + +CHANNEL DIPLODOCUS_C_Design__channel_0 BRBW 4 8 OUT DIPLODOCUS_C_Design__PrimitiveComp1_0 IN DIPLODOCUS_C_Design__PrimitiveComp2_0 + + + + +//todo1 + +// todo2 + //todo3 \ No newline at end of file diff --git a/ttool/src/test/resources/tmltranslator/input/file5.tml b/ttool/src/test/resources/tmltranslator/input/file5.tml index a2b9bcce51..0dccf91891 100644 --- a/ttool/src/test/resources/tmltranslator/input/file5.tml +++ b/ttool/src/test/resources/tmltranslator/input/file5.tml @@ -1,4 +1,16 @@ -// File with comment + context 2 -// Channels + // File with comment + context 2 + + + + // Channels CHANNEL DIPLODOCUS_C_Design__channel BRBW 4 8 OUT DIPLODOCUS_C_Design__PrimitiveComp1 IN DIPLODOCUS_C_Design__PrimitiveComp2 + + + + + + + + + CHANNEL DIPLODOCUS_C_Design__channel_0 BRBW 4 8 OUT DIPLODOCUS_C_Design__PrimitiveComp1_0 IN DIPLODOCUS_C_Design__PrimitiveComp2_0 \ No newline at end of file diff --git a/ttool/src/test/resources/tmltranslator/input/file6.tml b/ttool/src/test/resources/tmltranslator/input/file6.tml index 864b0d1e23..54427737b0 100644 --- a/ttool/src/test/resources/tmltranslator/input/file6.tml +++ b/ttool/src/test/resources/tmltranslator/input/file6.tml @@ -1,4 +1,16 @@ -// File with comment + context 3 -// Channels -CHANNEL DIPLODOCUS_C_Design__channel BRBW 5 8 OUT DIPLODOCUS_C_Design__PrimitiveComp1 IN DIPLODOCUS_C_Design__PrimitiveComp2 -CHANNEL DIPLODOCUS_C_Design__channel_0 BRBW 4 8 OUT DIPLODOCUS_C_Design__PrimitiveComp1_0 IN DIPLODOCUS_C_Design__PrimitiveComp2_0 \ No newline at end of file + // File with comment + context 2 + + + + // Channels +CHANNEL DIPLODOCUS_C_Design__channel BRBW 4 8 OUT DIPLODOCUS_C_Design__PrimitiveComp1 IN DIPLODOCUS_C_Design__PrimitiveComp2 + + + + + + + + + +CHANNEL DIPLODOCUS_C_Design__channel_0 BRBW 4 8 OUT DIPLODOCUS_C_Design__PrimitiveComp1_0 IN DIPLODOCUS_C_Design__PrimitiveComp2_0 \ No newline at end of file diff --git a/ttool/src/test/resources/tmltranslator/input/file7.tml b/ttool/src/test/resources/tmltranslator/input/file7.tml index 58da6df298..476f5ce835 100644 --- a/ttool/src/test/resources/tmltranslator/input/file7.tml +++ b/ttool/src/test/resources/tmltranslator/input/file7.tml @@ -1,4 +1,30 @@ -// File with comment + context 3 -// Channels + // File with comment + context 2 + + + + // Channels CHANNEL DIPLODOCUS_C_Design__channel BRBW 4 8 OUT DIPLODOCUS_C_Design__PrimitiveComp1 IN DIPLODOCUS_C_Design__PrimitiveComp2 -CHANNEL DIPLODOCUS_C_Design__channel_0 BRBW 4 8 OUT DIPLODOCUS_C_Design__PrimitiveComp1_0 IN DIPLODOCUS_C_Design__PrimitiveComp2_0 \ No newline at end of file + + + + + + + + + +CHANNEL DIPLODOCUS_C_Design__channel_0 BRBW 4 8 OUT DIPLODOCUS_C_Design__PrimitiveComp1_0 IN DIPLODOCUS_C_Design__PrimitiveComp2_0 + + + + + +CHANNEL DIPLODOCUS_C_Design__channel_0 BRBW 4 8 OUT DIPLODOCUS_C_Design__PrimitiveComp1_0 IN DIPLODOCUS_C_Design__PrimitiveComp2_0 + + + // Event + + + EVENT + + EVENT -- GitLab