Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: installer/src/installer-lib/test/database_test.cpp

Issue 5992177905696768: Issue #1186 - Rename symbols defined in 'installer-lib' (Closed)
Patch Set: fixed issues; rebased; new fixes from rebase Created June 19, 2015, 4:09 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 #include <gtest/gtest.h> 1 #include <gtest/gtest.h>
2 #include "../database.h" 2 #include "../database.h"
3 3
4 /* 4 /*
5 * Note: These tests need to be run in the same directory as the MSI file. 5 * Note: These tests need to be run in the same directory as the MSI file.
6 * There's a batch file for that purpose "run-tests.cmd". 6 * There's a batch file for that purpose "run-tests.cmd".
7 */ 7 */
8 8
9 TEST( Database, open ) 9 TEST( Database, open )
10 { 10 {
11 File_System_Database db( L"test-installer-lib.msi" ) ; 11 FileSystemDatabase db( L"test-installer-lib.msi" ) ;
12 } 12 }
13 13
14 class Database_F 14 class Database_F
15 : public ::testing::Test 15 : public ::testing::Test
16 { 16 {
17 protected: 17 protected:
18 File_System_Database db ; 18 FileSystemDatabase db ;
19 19
20 Database_F() 20 Database_F()
21 : db( L"test-installer-lib.msi" ) 21 : db( L"test-installer-lib.msi" )
22 {} 22 {}
23 } ; 23 } ;
24 24
25 TEST_F( Database_F, view_n_columns_and_n_rows ) 25 TEST_F( Database_F, view_n_columns_and_n_rows )
26 { 26 {
27 View v( db, L"SELECT * FROM AbpUIText" ) ; 27 View v( db, L"SELECT * FROM AbpUIText" ) ;
28 Record r( v.first() ) ; 28 Record r( v.First() ) ;
29 unsigned int j ; 29 unsigned int j ;
30 for ( j = 0 ; r != v.end() ; ++ j ) 30 for ( j = 0 ; r != v.End() ; ++ j )
31 { 31 {
32 ASSERT_EQ( 3, r.n_fields() ) ; 32 ASSERT_EQ( 3, r.NumberOfFields() ) ;
33 r = v.next() ; 33 r = v.Next() ;
34 } 34 }
35 ASSERT_EQ( 4, j ) ; 35 ASSERT_EQ( 4, j ) ;
36 } 36 }
37 37
38 TEST_F( Database_F, view_single_record ) 38 TEST_F( Database_F, view_single_record )
39 { 39 {
40 View v( db, L"SELECT `content` FROM `AbpUIText` WHERE `component`='close_ie' a nd `id`='dialog_unknown'" ) ; 40 View v( db, L"SELECT `content` FROM `AbpUIText` WHERE `component`='close_ie' a nd `id`='dialog_unknown'" ) ;
41 Record r( v.first() ) ; 41 Record r( v.First() ) ;
42 ASSERT_EQ( 1, r.n_fields() ) ; 42 ASSERT_EQ( 1, r.NumberOfFields() ) ;
43 std::wstring s( r.value_string( 1 ) ) ; 43 std::wstring s( r.ValueString( 1 ) ) ;
44 std::wstring expected( L"IE is still running" ) ; 44 std::wstring expected( L"IE is still running" ) ;
45 ASSERT_GT( s.length(), expected.length() ) ; 45 ASSERT_GT( s.length(), expected.length() ) ;
46 std::wstring prefix( s.substr( 0, expected.length() ) ) ; 46 std::wstring prefix( s.substr( 0, expected.length() ) ) ;
47 ASSERT_EQ( prefix, expected ) ; 47 ASSERT_EQ( prefix, expected ) ;
48 r = v.next() ; 48 r = v.Next() ;
49 ASSERT_EQ( v.end(), r ) ; 49 ASSERT_EQ( v.End(), r ) ;
50 } 50 }
51 51
52 TEST_F( Database_F, view_single_record_parametric ) 52 TEST_F( Database_F, view_single_record_parametric )
53 { 53 {
54 View v( db, L"SELECT `content` FROM `AbpUIText` WHERE `component`='close_ie' a nd `id`=?" ) ; 54 View v( db, L"SELECT `content` FROM `AbpUIText` WHERE `component`='close_ie' a nd `id`=?" ) ;
55 Record arg( 1 ) ; 55 Record arg( 1 ) ;
56 arg.assign_string( 1, L"dialog_unknown" ) ; 56 arg.AssignString( 1, L"dialog_unknown" ) ;
57 Record r( v.first( arg ) ) ; 57 Record r( v.First( arg ) ) ;
58 ASSERT_EQ( 1, r.n_fields() ) ; 58 ASSERT_EQ( 1, r.NumberOfFields() ) ;
59 std::wstring s( r.value_string( 1 ) ) ; 59 std::wstring s( r.ValueString( 1 ) ) ;
60 std::wstring expected( L"IE is still running" ) ; 60 std::wstring expected( L"IE is still running" ) ;
61 ASSERT_GT( s.length(), expected.length() ) ; 61 ASSERT_GT( s.length(), expected.length() ) ;
62 std::wstring prefix( s.substr( 0, expected.length() ) ) ; 62 std::wstring prefix( s.substr( 0, expected.length() ) ) ;
63 ASSERT_EQ( prefix, expected ) ; 63 ASSERT_EQ( prefix, expected ) ;
64 r = v.next() ; 64 r = v.Next() ;
65 ASSERT_EQ( v.end(), r ) ; 65 ASSERT_EQ( v.End(), r ) ;
66 } 66 }
OLDNEW
« no previous file with comments | « installer/src/installer-lib/session.cpp ('k') | installer/src/installer-lib/test/exception_test.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld