『壹』 Oasis 樂隊的《Supersonic》 的中文歌詞
Supersonic 中文歌詞
Wikipedia,自由的網路全書
收錄專輯:Definitely Maybe
Supersonic 超音速
I need to be myself
我要做自己
I can't be no one else
我不要像其他人一樣
I'm feeling supersonic
我正享受著超音速
Give me gin and tonic
請給我一杯gin and tonic
You can have it all but how much do you want it?
你可以一飲而盡但要喝多少杯才夠
You make me laugh
你讓我大笑
Give me your autograph
請給我你的簽名
Can I ride with you in your BMW ?
我可以坐上你的BMW一起兜風嗎?
You can sail with me in my yellow submarine
還是你可以坐上我的黃色潛水艇一同共游 (注1)
You need to find out
你得好好思索
'Cos no one's gonna tell you what I'm on about
因為不會有人告訴你我所言為何
You need to find a way for what you want to say
你得想辦法讓自己暢其所言
But before tomorrow
但得在天亮之前
'Cos my friend said he'd take you home
因為我的朋友說他會帶你回家
He sits in a corner all alone
他坐在角落獨自一個人
He lives under a waterfall
他住在瀑布底下
No body can see him
別人見不到他
No body can ever hear him call
也聽不到他的呼喚
You need to be yourself
你得做你自己
You can't be no one else
不要像其他人一樣
I know a girl called Elsa
我認識個叫做Elsa的女孩
She's into Alka Seltzer
她對Alka Seltzer很著迷(注2)
She sniffs it through a cane on a supersonic train
她在超音速火車里用根管子吸食它
She made me laugh
她曾讓我大笑
I got her autograph
我也拿過她的簽名
She done it with a doctor on a helicopter
她曾在直升機里和一位醫生搞過
She's sniffin in her tissue
而如今她卻拿衛生紙直打噴嚏
Sellin' the Big Issue
在大街上叫賣雜志 (注3)
And She finds out
而現在她終於了解
no one's gonna tell her what I'm on about
沒有人要告訴她我所言為何
You need to find a way for what she wants to say
你得想辦法聽懂她要講什麼
But before tomorrow
但得在天亮之前
'Cos my friend said he'd take you home
因為我的朋友說他會帶你回家
He sits in a corner all alone
他坐在角落獨自一個人
He lives under a waterfall
他住在瀑布底下
No body can see him
別人見不到他
No body can ever hear him call
也聽不到他的呼喚
『貳』 gtest測試用例必須是.cc 後綴嗎
是的,省略了部分錯誤信息,看到了undefined reference,編譯通過,但是鏈接失敗,可以猜測是沒有找到對應的庫。再仔細看實際執行時列印的命令為
g++ -o test_main.o -c test_main.cpp
g++ -o test_main test_main.o
很顯然,沒有引入gtest的頭文件,也沒有載入gtest對應的庫。
『叄』 如何使用GTest對Qt工程代碼做unit test
googletest是一個用來寫C++單元測試的框架,它是跨平台的,可應用在windows、linux、Mac等OS平台上。下面,我來說明如何使用最新的1.6版本gtest寫自己的單元測試。 本文包括以下幾部分:1、獲取並編譯googletest(以下簡稱為gtest);2、如何編寫單元測試用例;3、如何執行單元測試。4、google test內部是如何執行我們的單元測試用例的。 1. 獲取並編譯gtest gtest試圖跨平台,理論上,它就應該提供多個版本的binary包。但事實上,gtest只提供源碼和相應平台的編譯方式,這是為什麼呢?google的解釋是,我們在編譯出gtest時,有些獨特的工程很可能希望在編譯時加許多flag,把編譯的過程下放給用戶,可以讓用戶更靈活的處理。這個仁者見仁吧,反正也是免費的BSD許可權。 目前gtest提供的是1.6.0版本,我們看看與以往版本1.5.0的區別: [cpp] view plain Changes for 1.6.0: * New feature: ADD_FAILURE_AT() for reporting a test failure at the given source location -- useful for writing testing utilities. 。。。 。。。 * Bug fixes and implementation clean-ups. * Potentially incompatible changes: disables the harmful 'ma...
『肆』 怎麼在visual studio中用gtest
運行msvc下的gtest.sln文件,它會提示自動升級為新的解決方案,然後生成即可。記得Debug和Release都要生成,分別用於測試Debug和Release方案的代碼。我使用的是以下4個文件,還可以使用另外一個.sln文件,請自行文檔之~
msvc\gtest\Debug - Debug方案下的二進制文件:gtestd.lib、gtest_maind.lib(注意主文件名的d後綴)
msvc\gtest\Release - Release方案下的二進制文件:gtest.lib、gtest_main.lib
『伍』 如何編譯google test的例子
Cmake generates native build scripts. 先建立mybuild目錄
# cd /usr/src/gtest-1.5.0
# mddir mybuild
# cd mybuild
(1) only generate gtest_unittest
# cmake /usr/src/gtest-1.5.0 //generate Makefile
# make //generate executable file gtest_unittest
(2) generate gtest_unittest and all samples
//generate Makefile with Google Test's samples to be compiled
# cmake -Dbuild_gtest_samples=ON /usr/src/gtest-1.5.0
//generate executable files gtest_unittest, sample1_unittest, sample2_unittest, ...
# make
Reference
http://code.google.com/p/googletest
../readme
Appendix. 使用CMake編譯gtest_unittest和samples
//生成Makefile文件
root@yu29:/usr/src/gtest-1.5.0/mybuild# cmake -Dbuild_gtest_samples=ON /usr/src/gtest-1.5.0
-- The CXX compiler identification is GNU
-- The C compiler identification is GNU
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Looking for include files CMAKE_HAVE_PTHREAD_H
-- Looking for include files CMAKE_HAVE_PTHREAD_H - found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found pythonInterp: /usr/bin/python2.6
-- Configuring done
-- Generating done
-- Build files have been written to: /usr/src/gtest-1.5.0/mybuild
root@yu29:/usr/src/gtest-1.5.0/mybuild# ls
CMakeCache.txt CMakeFiles cmake_install.cmake CTestTestfile.cmake Makefile
//編譯
root@yu29:/usr/src/gtest-1.5.0/mybuild# make
Scanning dependencies of target gtest
[ 5%] Building CXX object CMakeFiles/gtest.dir/src/gtest-all.cc.o
Linking CXX static library libgtest.a
[ 5%] Built target gtest
Scanning dependencies of target gtest_main
[ 11%] Building CXX object CMakeFiles/gtest_main.dir/src/gtest_main.cc.o
...
//生成了所有samples的可執行程序
root@yu29:/usr/src/gtest-1.5.0/mybuild# ls
CMakeCache.txt libgtest.a sample2_unittest sample7_unittest
CMakeFiles libgtest_main.a sample3_unittest sample8_unittest
cmake_install.cmake Makefile sample4_unittest sample9_unittest
CTestTestfile.cmake sample10_unittest sample5_unittest
gtest_unittest sample1_unittest sample6_unittest
//看看sample2的執行結果
root@yu29:/usr/src/gtest-1.5.0/mybuild# ./sample2_unittest
Running main() from gtest_main.cc
[==========] Running 4 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 4 tests from MyString
[ RUN ] MyString.DefaultConstructor
[ OK ] MyString.DefaultConstructor (0 ms)
[ RUN ] MyString.ConstructorFromCString
[ OK ] MyString.ConstructorFromCString (0 ms)
[ RUN ] MyString.CopyConstructor
[ OK ] MyString.CopyConstructor (0 ms)
[ RUN ] MyString.Set
[ OK ] MyString.Set (0 ms)
[----------] 4 tests from MyString (0 ms total)
[----------] Global test environment tear-down
[==========] 4 tests from 1 test case ran. (1 ms total)
[ PASSED ] 4 tests.
//gtest_unittest的執行結果較長,此處不再顯示。
『陸』 googletest的安裝和使用
git clone https://github.com/google/googletest/tree/master/googletest.git
mkdir mybuild
cd mybuild
生成構建gtest所需要的輔助文件
cmake ../google
make
如果make報錯很多,是因為gcc等級不夠,不支持c++11,先升級gcc,我的當前gcc等級為8.3.1
3.1 在/usr/lib底下新建文件夾gtest
cd /usr/lib
mkdir gtest
3.2 將mybuild/lib中生成的libgmock.a、libgmock_main.a、libgtest.a、libgtest_main.a復制到新建的/usr/lib/gtest中
3.3 源文件拷貝
不是所有文件,只需要拷貝gtest/googletest/googletest/include/gtest
cp -r gtest/googletest/googletest/include/gtest /usr/include/
編譯: g++ gtest.cpp -lgtest -lpthread
運行: ./a.out
『柒』 jenkins報錯找不到gtest結果文件
因為不是Jenkins容器目錄從而導致報錯。
代碼是儲存在docker容器內,而Jenkins在構建時跑dockerrun命令時調用的是本地目錄,不是Jenkins容器目錄從而導致報錯。解決方法如下:
1、maven的pom文件的修改:需要在依賴下
2、選擇項目右擊---Runas---Mavenbuild輸入命令test就可以了。
3、jenkins新建一個maven項目,然後選擇svn目錄,構建輸入test命令,然後可以在構建後添加一個TestNGXMLreport也可以添加別的測試報告。記得下載對應的插件。
『捌』 Linux平台如何編譯使用Google test寫的單元測試
(請參考readme文件) Step1.編譯gtest-all.cc和gtest_main.cc文件g++ -I${GTEST_DIR}/include -I${GTEST_DIR} -c ${GTEST_DIR}/src/gtest-all.ccg++ -I${GTEST_DIR}/include -I${GTEST_DIR} -c ${GTEST_DIR}/src/gtest_main.cc Step2.將step1生成的gtest-all.o和gtest_main.o打包成靜態庫libgtest.aar -rv libgtest.a gtest-all.o gtest_main.o Step3.編譯要測試的代碼(假設文件名為sample.cpp)g++ -I${GTEST_DIR}/include -c sample.cpp Step4.編譯單元測試的代碼(假設文件名為test.cpp)g++ -I${GTEST_DIR}/include -c test.cpp Step5.與libgtest.a或其他需要的庫鏈接、生成可執行程序g++ -I${GTEST_DIR}/include test.o sample.o libgtest.a -o test 其他的庫,如pthread庫。簡單版本all:g++ -I/usr/src/gtest-1.5.0/include -I/usr/src/gtest-1.5.0 -g -c /usr/src/gtest-1.5.0/src/gtest-all.ccg++ -I/usr/src/gtest-1.5.0/include -I/usr/src/gtest-1.5.0 -g -c /usr/src/gtest-1.5.0/src/gtest_main.ccar -rv libgtest.a gtest-all.o gtest_main.og++ -I/usr/src/gtest-1.5.0/include -g -c sample.cppg++ -I/usr/src/gtest-1.5.0/include -g -c test.cppg++ -I/usr/src/gtest-1.5.0/include -lpthread test.o sample.o libgtest.a -g -o testclean:rm test libgtest.a *.o 實際上,其中將gtest-all.o和gtest_main.o壓縮為libgtest.a庫,可以省去,直接使用.o文件,如下。all:g++ -I/usr/src/gtest-1.5.0/include -I/usr/src/gtest-1.5.0 -g -c /usr/src/gtest-1.5.0/src/gtest-all.ccg++ -I/usr/src/gtest-1.5.0/include -I/usr/src/gtest-1.5.0 -g -c /usr/src/gtest-1.5.0/src/gtest_main.ccg++ -I/usr/src/gtest-1.5.0/include -g -c sample.cppg++ -I/usr/src/gtest-1.5.0/include -g -c test.cppg++ -I/usr/src/gtest-1.5.0/include -lpthread test.o sample.o gtest-all.o gtest_main.o -g -o testclean:rm test *.o正式版本# Google Test directoryGTEST_DIR = /usr/src/gtest-1.5.0 # Flags passed to the preprocessor.CPPFLAGS += -I$(GTEST_DIR)/include # Flags passed to the C++ compiler.CXXFLAGS += -g -Wall -Wextra # All Google Test headers. Usually you shouldn't change this definition.GTEST_HEADERS = $(GTEST_DIR)/include/gtest/*.h $(GTEST_DIR)/include/gtest/internal/*.h # All Google Test sourcesGTEST_SRCS_ = $(GTEST_DIR)/src/*.cc $(GTEST_DIR)/src/*.h $(GTEST_HEADERS) # All tests proced by this Makefile. Remember to add new tests you created to the list.TESTS = test all : $(TESTS) clean :rm -f $(TESTS) gtest.a gtest_main.a *.o gtest-all.o : $(GTEST_DIR)/src/gtest-all.cc # $(GTEST_SRCS_)$(CXX) $(CPPFLAGS) -I$(GTEST_DIR) $(CXXFLAGS) -c $(GTEST_DIR)/src/gtest-all.cc gtest_main.o : $(GTEST_DIR)/src/gtest_main.cc # $(GTEST_SRCS_)$(CXX) $(CPPFLAGS) -I$(GTEST_DIR) $(CXXFLAGS) -c $(GTEST_DIR)/src/gtest_main.cc gtest_main.a : gtest-all.o gtest_main.o$(AR) $(ARFLAGS) $@ $^ sample.o : sample.cpp sample.h $(GTEST_HEADERS)$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c sample.cpp test.o : test.cpp sample.h $(GTEST_HEADERS)$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c test.cpp test : sample.o test.o gtest_main.a$(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@$^代表依賴項,$@代表目標。
『玖』 linux下怎麼退出gtest
(請參考readme文件)??Step1.編譯gtest-all.cc和gtest_main.cc文件g++ -I${GTEST_DIR}/include -I${GTEST_DIR} -c ${GTEST_DIR}/src/gtest-all.ccg++ -I${GTEST_DIR}/include -I${GTEST_DIR} -c ${GTEST_DIR}/src/gtest_main.cc??Step2.將step1生成的gtest-all.o和gtest_main.o打包成靜態庫libgtest.aar -rv libgtest.a gtest-all.o gtest_main.o??Step3.編譯要測試的代碼(假設文件名為sample.cpp)g++ -I${GTEST_DIR}/include -c sample.cpp??Step4.編譯單元測試的代碼(假設文件名為test.cpp)g++ -I${GTEST_DIR}/include -c test.cpp??Step5.與libgtest.a或其他需要的庫鏈接、生成可執行程序g++ -I${GTEST_DIR}/include test.o sample.o libgtest.a -o test??其他的庫,如pthread庫。簡單版本all:g++ -I/usr/src/gtest-1.5.0/include -I/usr/src/gtest-1.5.0 -g -c /usr/src/gtest-1.5.0/src/gtest-all.ccg++ -I/usr/src/gtest-1.5.0/include -I/usr/src/gtest-1.5.0 -g -c /usr/src/gtest-1.5.0/src/gtest_main.ccar -rv libgtest.a gtest-all.o gtest_main.og++ -I/usr/src/gtest-1.5.0/include -g -c sample.cppg++ -I/usr/src/gtest-1.5.0/include -g -c test.cppg++ -I/usr/src/gtest-1.5.0/include -lpthread test.o sample.o libgtest.a -g -o testclean:rm test libgtest.a *.o??實際上,其中將gtest-all.o和gtest_main.o壓縮為libgtest.a庫
『拾』 如何使用gtest參數跑特定用例
googletest是一個用來寫C++單元測試的框架,它是跨平台的,可應用在windows、linux、Mac等OS平台上。下面,我來說明如何使用最新的1.6版本gtest寫自己的單元測試。 本文包括以下幾部分:1、獲取並編譯googletest(以下簡稱為gtest);