代码样式测试
hyang0
posted @ 2010年11月27日 01:36
in test
, 965 阅读
#include <iostream> #include <string.h> using namespace std; class Person{ char* pName; char* pSex; public: Person(char* pN="noName", char* pS="female"){ #include <iostream> #include <string.h> using namespace std; class Person{ char* pName; char* pSex; public: Person(char* pN="noName", char* pS="female"){ cout<<"Constructing :\n"<<pN<<"\n"<<pS<<"\n"; pName = new char[strlen(pN)+1]; pSex = new char[strlen(pS)+1]; if(pName) strcpy(pName, pN); if(pSex) strcpy(pSex, pS); } Person(const Person& s){ cout<<"copy Constructing :\n"<<s.pName<<"\n"<<s.pSex<<"\n"; pName = new char[strlen(s.pName)+1]; pSex = new char[strlen(s.pSex)+1]; if(pName) strcpy(pName, s.pName); if(pSex) strcpy(pSex, s.pSex); } Person& operator=(Person& pName){ cout<<"Assigning :\n"<<pName.pName<<"\n"<<pName.pSex<<"\n"; if(this==&pName) return pName; delete[] this->pName; delete[] this->pSex; this->pName = new char[strlen(pName.pName)+1]; this->pSex = new char[strlen(pName.pSex)+1]; if(this->pName) strcpy(this->pName, pName.pName); if(this->pSex) strcpy(this->pSex, pName.pSex); return *this; } ~Person(){ cout<<"Destructing :\n"<<pName<<"\n"<<pSex<<"\n"; delete[] pName; delete[] pSex; } }; int main() { while(1) { Person p1("Randy","male"); Person p2("Rudi","male"); p2 = p1; } } cout<<"Constructing :\n"<<pN<<"\n"<<pS<<"\n"; pName = new char[strlen(pN)+1]; pSex = new char[strlen(pS)+1]; if(pName) strcpy(pName, pN); if(pSex) strcpy(pSex, pS); } Person(const Person& s){ cout<<"copy Constructing :\n"<<s.pName<<"\n"<<s.pSex<<"\n"; pName = new char[strlen(s.pName)+1]; pSex = new char[strlen(s.pSex)+1]; if(pName) strcpy(pName, s.pName); if(pSex) strcpy(pSex, s.pSex); } Person& operator=(Person& pName){ cout<<"Assigning :\n"<<pName.pName<<"\n"<<pName.pSex<<"\n"; if(this==&pName) return pName; delete[] this->pName; delete[] this->pSex; this->pName = new char[strlen(pName.pName)+1]; this->pSex = new char[strlen(pName.pSex)+1]; if(this->pName) strcpy(this->pName, pName.pName); if(this->pSex) strcpy(this->pSex, pName.pSex); return *this; } ~Person(){ cout<<"Destructing :\n"<<pName<<"\n"<<pSex<<"\n"; delete[] pName; delete[] pSex; } }; int main() { while(1) { Person p1("Randy","male"); Person p2("Rudi","male"); p2 = p1; } }
#!/bin/bash #=============================================================================== # # FILE: color.sh # # USAGE: ./color.sh # # DESCRIPTION: # # OPTIONS: --- # REQUIREMENTS: --- # BUGS: --- # NOTES: --- # AUTHOR: hyang0 (), hyang0@windriver.com # COMPANY: WindRiver # VERSION: 1.0 # CREATED: 08/25/2010 04:51:25 PM CST # REVISION: --- #=============================================================================== # # This file echoes a bunch of color codes to the # terminal to demonstrate what's available. Each # line is the color code of one forground color, # out of 17 (default + 16 escapes), followed by a # test use of that color on all nine background # colors (default + 8 escapes). # echo -e "\033[47m" cat <<DOC README 字背景颜色范围:40----49 40:黑 41:深红 42:绿 43:黄色 44:蓝色 45:紫色 46:深绿 47:白色 字颜色:30-----------39 30:黑 31:红 32:绿 33:黄 34:蓝色 35:紫色 36:深绿 37:白色 ANSI控制码的说明 QUOTE: \033[0m 关闭所有属性 \033[1m 设置高亮度 \033[4m 下划线 \033[5m 闪烁 \033[7m 反显 \033[8m 消隐 \033[30m -- \33[37m 设置前景色 \033[40m -- \33[47m 设置背景色 \033[nA 光标上移n行 \033[nB 光标下移n行 \033[nC 光标右移n行 \033[nD 光标左移n行 \033[y;xH设置光标位置 \033[2J 清屏 \033[K 清除从光标到行尾的内容 \033[s 保存光标位置 \033[u 恢复光标位置 \033[?25l 隐藏光标 \033[?25h 显示光标 Example: 关属性 格式: echo -e "\033[字背景颜色;字体颜色m字符串\033[0m" echo -e "\033[46;31m AAA \033[0m" DOC echo -e "\t\t\t \033[46;31m AAA \033[0m" T='gYw' # The test text echo -e "\n \t\t 40m\t 41m\t 42m\t 43m\ \t 44m\t 45m\t 46m\t 47m"; for FGs in 'm' '1m' '30m' '1;30m' '31m' '1;31m' '32m' \ '1;32m' '33m' '1;33m' '34m' '1;34m' '35m' '1;35m' \ '36m' '1;36m' '37m' '1;37m'; do FG=${FGs// /} echo -en " $FGs \t\033[$FG $T " for BG in 40m 41m 42m 43m 44m 45m 46m 47m; do echo -en "$EINS \t\033[$FG\033[$BG $T \033[0m"; done echo; done echo
#!/bin/bash #=============================================================================== # # FILE: qfbatch-example.sh # # USAGE: ./qfbatch.sh [workbench-install-dir] [vnc-number] # # DESCRIPTION: To run batch mode qftest on special vnc client. # # OPTIONS: --- # REQUIREMENTS: --- # BUGS: --- # NOTES: --- # AUTHOR: hyang0 (), haibo.yang@windriver.com # COMPANY: WindRiver # VERSION: 1.0 # CREATED: 11/01/2010 09:53:00 AM CST # REVISION: --- #=============================================================================== umask 000 DVDSPIN=$1 VNCNUM=$2 if [ -z $DVDSPIN ] then echo "dvd spin directory not found!" exit -1 fi if [ -z $VNCNUM ] then echo "vnc number :$VNCNUM not found!" exit -1 fi QFHOME=/folk/hyang0/qftest/qftest-3.2.2/bin INSTALLDIR=$DVDSPIN WORKSPACE=/folk/hyang0/workspace-wb33$$ CONFIGURATION=/folk/hyang0/configuration-wb33$$ export DISPLAY=:$VNCNUM.0 $QFHOME/qftest -batch \ -J-Duser.language=en \ -variable client_wb33=wb33_$VNCNUM \ -variable installdir_wb33=$INSTALLDIR \ -variable workspace_wb33=$WORKSPACE \ -variable configuration_wb33=$CONFIGURATION \ -report.html /folk/hyang0/rep_+b_+y-+M-+d_+h:+m \ -runlog /folk/hyang0/+b_+y-+M-+d_+h:+m.qrz \ -test "567-rtp-realboard-b" \ -run /folk/hyang0/dfe_auto/Windows/vxWorks/DFE_Regression_VX_Debug_view.qft ret=$? if [[ $ret == 0 || $ret == 1 ]]; then case $ret in 0) echo "Test case DFE_Regression_VX_Debug_view.qft:" echo " Everything OK" ;; 1) echo "Test case DFE_Regression_VX_Debug_view.qft:" echo " Warnings occurred during the test run" ;; esac echo "PASS" else case $ret in 2) echo "Test case DFE_Regression_VX_Debug_view.qft:" echo " Errors occurred during the test run " ;; 3) echo "Test case DFE_Regression_VX_Debug_view.qft:" echo " Exceptions occurred during the test run " ;; -1) echo "Test case DFE_Regression_VX_Debug_view.qft:" echo " Unexpected Exception " ;; -2) echo "Test case DFE_Regression_VX_Debug_view.qft:" echo " Bad command line arguments " ;; -3) echo "Test case DFE_Regression_VX_Debug_view.qft:" echo " Missing or invalid license " ;; -4) echo "Test case DFE_Regression_VX_Debug_view.qft:" echo " Errors while setting up the RMI connection " ;; -5) echo "Test case DFE_Regression_VX_Debug_view.qft:" echo " Errors while loading the test-suite " ;; -6) echo "Test case DFE_Regression_VX_Debug_view.qft:" echo " The test-suite doesn’t contain any tests " ;; *) echo "Test case DFE_Regression_VX_Debug_view.qft:" echo " Error $ret: something unexpected!" ;; esac echo "FAIL" fi vncserver -kill :$VNCNUM
2022年10月20日 08:01
Your idea is different. I was noticing the design and color scheme of your page for developing next http://www.huffpost.com/archive/ca/entry/to-pay-or-not-to-pay-someone-to-write-my-essay-for-me_b_14793970 module. Thank you for sharing valuable content. Good job done.
2024年1月17日 21:46
오피타임's serene environment is my escape from daily stress.
2024年1月18日 05:02
The stone massage therapy at 제주출장마사지 is a must-try!