tests.c

来自「ssd6 exercise2 该文件是2008 年icarnegie的最新版」· C语言 代码 · 共 112 行

C
112
字号
/* Testing Code */// *  this test.c is over'd by the author yangxinhai at the time of 2008/10/15/9:38
// *	author:Yang_xinhai
// *	ID	  : 063458
// *	class : RJ010609
// *	date  : 2008/10/15
// *	time  : 9:38#include <limits.h>int test_bitAnd(int x, int y){  return x&y;}int test_bitOr(int x, int y){  return x|y;}int test_isZero(int x) {  return x == 0;}int test_minusOne(void) {  return -1;}int test_tmax(void) {  return LONG_MAX;}int test_bitXor(int x, int y){  return x^y;}int test_getByte(int x, int n){  union  {    int word;    unsigned char bytes[4];  } u;  int test = 1;  int littleEndian = (int) *(char *) &test;  u.word = x;  return littleEndian ? (unsigned) u.bytes[n] : (unsigned) u.bytes[3-n];}int test_isEqual(int x, int y){  return x == y; }int test_negate(int x) {  return -x;}int test_isPositive(int x) {  return x > 0;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?