From: Mukund Sivaraman Date: Sun, 4 Nov 2012 16:19:56 +0000 (+0530) Subject: [2369] Read data from the test file to check the InputSource X-Git-Tag: trac2487_base~18^2~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4d7d67838cb15ce75ceab0664e7b25e4b58d658a;p=thirdparty%2Fkea.git [2369] Read data from the test file to check the InputSource --- diff --git a/src/lib/dns/tests/master_lexer_inputsource_unittest.cc b/src/lib/dns/tests/master_lexer_inputsource_unittest.cc index efc90b2bc6..1031d0202c 100644 --- a/src/lib/dns/tests/master_lexer_inputsource_unittest.cc +++ b/src/lib/dns/tests/master_lexer_inputsource_unittest.cc @@ -118,16 +118,13 @@ TEST_F(InputSourceTest, stream) { } TEST_F(InputSourceTest, file) { - const char* str = - ";; a simple (incomplete) zone file\n" - "\n" - "example.com. 3600 IN TXT \"test data\"\n" - "www.example.com. 60 IN A 192.0.2.1\n" - "www.example.com. 60 IN A 192.0.2.2\n"; - size_t str_length = strlen(str); + std::ifstream fs(TEST_DATA_SRCDIR "/masterload.txt"); + std::string str((std::istreambuf_iterator(fs)), + std::istreambuf_iterator()); + fs.close(); InputSource source(TEST_DATA_SRCDIR "/masterload.txt"); - checkGetAndUngetChar(source, str, str_length); + checkGetAndUngetChar(source, str.c_str(), str.size()); } // ungetAll() should skip back to the place where the InputSource