test.h
来自「伯克利做的SFTP安全文件传输协议」· C头文件 代码 · 共 64 行
H
64 行
// test.h// utilities for test code// copyright SafeTP Development Group, Inc., 2000 Terms of use are as specified in license.txt#ifndef __TEST_H#define __TEST_H#include <iostream.h> // cout#include <stdio.h> // printf#include "exc.h" // xBase#include "nonport.h" // getMilliseconds// reports uncaught exceptions#define USUAL_MAIN \int main() \{ \ try { \ entry(); \ return 0; \ } \ catch (xBase &x) { \ cout << "exception caught: " << x << endl; \ return 4; \ } \}// same as above, but with command-line args#define ARGS_MAIN \int main(int argc, char *argv[]) \{ \ try { \ entry(argc, argv); \ return 0; \ } \ catch (xBase &x) { \ cout << "exception caught: " << x << endl; \ return 4; \ } \}// convenient for printing the value of a variable or expression#define PVAL(val) cout << #val << " = " << (val) << endl// easy way to time a section of codeclass TimedSection { char const *name; long start;public: TimedSection(char const *n) : name(n) { start = getMilliseconds(); } ~TimedSection() { cout << name << ": " << (getMilliseconds() - start) << " msecs\n"; }};#endif // __TEST_H
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?