コード例 #1
0
ファイル: simple.test1.cpp プロジェクト: SafirN/lnr1
    void test1 () {
      char const  data[6] = {'G','G','X','G','X','G'};
      int  const test_len = 6;

      int  const   result = count_if_followed_by (data, test_len, 'X', 'G');

      TS_ASSERT_EQUALS(result, 2);
    }
コード例 #2
0
ファイル: simple.cxxtest.cpp プロジェクト: lovelaze/cpp
	// SYNOPSIS:
	// result should be 2, testing with string initialization
	void test4Correct() {
		char const  data[10] = "korvbanan";
		
      	int  const test_len = 9;

		int  const   result = count_if_followed_by (data, test_len, 'a', 'n');

		TS_ASSERT_EQUALS(result, 2);
	}
コード例 #3
0
ファイル: simple.cxxtest.cpp プロジェクト: lovelaze/cpp
	// SYNOPSIS:
	// result should be 2
	void test3Correct() {
		char const  data[5] = {'H','E','J','E','J'};
		
      	int  const test_len = 5;

		int  const   result = count_if_followed_by (data, test_len, 'E', 'J');

		TS_ASSERT_EQUALS(result, 2);
	}
コード例 #4
0
ファイル: simple.cxxtest.cpp プロジェクト: lovelaze/cpp
	// SYNOPSIS:
	// result should be 0 since the range specified is 1, and we are comparing two characters
	void test2Incorrect() {
		char const  data[6] = {'X','G','X','G','X','G'};
		
      	int  const test_len = 1;

		int  const   result = count_if_followed_by (data, test_len, 'X', 'G');

		TS_ASSERT_DIFFERS(result, 0);

	}
コード例 #5
0
ファイル: simple.cxxtest.cpp プロジェクト: lovelaze/cpp
    // SYNOPSIS:
	// result should be 0 since the length specified is 0
    void test2Correct() {
		
		char const  data[6] = {'G','G','X','G','X','G'};
		
      	int  const test_len = 0;

		int  const   result = count_if_followed_by (data, test_len, 'F', 'G');

		TS_ASSERT_EQUALS(result, 0);
		
	}
コード例 #6
0
ファイル: simple.cxxtest.cpp プロジェクト: lovelaze/cpp
    void test1Correct () {
      char const  data[6] = {'G','G','X','G','X','G'};
      int  const test_len = 4;

      int  const   result = count_if_followed_by (data, test_len, 'X', 'G');

      // SYNOPSIS:
      //   result should be 1 since the length specified is 4,
      //   and only one pair of [X, G] is present in that range!

      TS_ASSERT_EQUALS(result, 1);
    }