1   /*
2    * "Peko" Visual Novel System
3    *
4    * All Rights Reserved.
5    * Copyright (c) 1999-2003 Tsukuba Bunko.
6    *
7    * $Id: PSMLUtilTestCase.java,v 1.1 2005/07/11 12:49:19 ppoi Exp $
8    */
9   package tsukuba_bunko.peko.scenario.test;
10  
11  import	junit.framework.TestCase;
12  
13  import	tsukuba_bunko.peko.scenario.PSMLUtil;
14  
15  
16  /***
17   * <code>{@see tsukuba_bunko.peko.scenario.PSMLUtil}</code> のテストケースです。
18   * @author	${Author}$
19   * @version	${Revision}$
20   */
21  public class PSMLUtilTestCase extends TestCase {
22  
23  	/***
24  	 * Constructor for PSMLUtilTestCase.
25  	 * @param arg0
26  	 */
27  	public PSMLUtilTestCase(String arg0)
28  	{
29  		super(arg0);
30  	}
31  
32  
33  	/***
34  	 * ISO 制御コードを含まない文字列の場合。入力と出力は同じインスタンス。
35  	 */
36  	public void testRemoveISOControlChar1()
37  	{
38  		String	string = "てきすとAreaに Text って書くテスト";
39  		String	result = PSMLUtil.removeISOControlChar( string );
40  		assertEquals( "result is not equals to string.", result, string );
41  		assertSame( "result is not same to string.", result, string );
42  	}
43  
44  	/***
45  	 * 前後に ISO 制御コードを含む文字列の場合。
46  	 */
47  	public void testRemoveISOControlChar2()
48  	{
49  		String	string = "てきすとAreaに Text って書くテスト";
50  		String	source = "\n\t\r\b" + string + "\t";
51  		assertTrue( !source.equals(string) );
52  		String	result = PSMLUtil.removeISOControlChar( source );
53  		assertEquals( "result is not equals to string.", result, string );
54  	}
55  
56  	/***
57  	 * 内部に ISO 制御コードを含む文字列の場合。
58  	 */
59  	public void testRemoveISOControlChar3()
60  	{
61  		String	string = "てきすとAreaに Text って書くテスト";
62  		String	source = "てきすとA\breaに\n\t Text って書\rくテスト";
63  		assertTrue( !source.equals(string) );
64  		String	result = PSMLUtil.removeISOControlChar( source );
65  		assertEquals( "result is not equals to string.", result, string );
66  	}
67  
68  	/***
69  	 * 前後・内部に ISO 制御コードを含む文字列の場合。
70  	 */
71  	public void testRemoveISOControlChar4()
72  	{
73  		String	string = "てきすとAreaに Text って書くテスト";
74  		String	source = "\nてき\t\r\bすとA\breaに\n\t Text って書\rくテスト\t\b\b\b\b";
75  		assertTrue( !source.equals(string) );
76  		String	result = PSMLUtil.removeISOControlChar( source );
77  		assertEquals( "result is not equals to string.", result, string );
78  	}
79  
80  	/***
81  	 * ISO 制御コードのみの文字列の場合。
82  	 */
83  	public void testRemoveISOControlChar5()
84  	{
85  		String	source = "\n\t\r\b\b\n\t\r\t";
86  		String	result = PSMLUtil.removeISOControlChar( source );
87  		assertEquals( "result is not empty string", result, "" );
88  	}
89  }