亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? btest.c

?? ssd6 exercise2 該文件是2008 年icarnegie的最新版
?? C
字號:
/*  * CS:APP Data Lab  *  *  this btest.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 * btest.c - A test harness that checks a student's solution  *           in bits.c for correctness.  * * Copyright (c) 2001, R. Bryant and D. O'Hallaron, All rights reserved. * May not be used, modified, or copied without permission. * * Usage: *    -e <N>       Limit number of errors to report for single function to N *    -f <Name>    Check only the named function *    -g           Print compact grading summary (implies -v 0 and -e 0) *    -h           Print help message *    -a           Don't check the student's identifying info structure *    -r <N>       Give uniform weight of N for all problems *    -v <N>       Set verbosity level to N *                 N=0:  Only give final scores *                 N=1:  Also report individual correctness scores (default) *  * Each problem has a weight 1 to 4, which is defined in legallist.c. */#include <stdio.h>#include <stdlib.h>#include <string.h>#include <limits.h>#include "btest.h"
#include "getopt.h"/* Globals defined in other modules */extern info_struct info;    /* defined in bits.c */extern test_rec test_set[]; /* defined in decl.c */                            /* and generated from templates in ./puzzles *//* Generate test values near "corner cases" */#define TEST_RANGE 5#define TEST_COUNT 33/* Print only compact grading summary if set (-g) */static int grade = 0;/* Max errors reported per function (-e) */static int error_limit = 1000;/* If non-NULL, test only one function (-f) */static char* test_fname = NULL;  /* Should I used fixed weight for rating, and if so, what should it be? (-r)*/static int global_rating = 0;/* Return random value between min and max */static int random_val(int min, int max){    double weight = rand()/(double) RAND_MAX;    int result = (int)(min * (1-weight) + max * weight);
    return result;}/* Generate the integer values we'll use to test a function */static int gen_vals(int test_vals[], int min, int max){    int i;    int test_count = 0;    /* If range small enough, then do exhaustively */    if (max-32 <= min) {	for (i = min; i <= max; i++)	    test_vals[test_count++] = i;	return test_count;    }    /* Otherwise, need to sample.       Do so near the boundaries and for a few random cases */    for (i = 0; i < TEST_RANGE; i++) {	test_vals[test_count++] = min+i;	test_vals[test_count++] = max-i;	test_vals[test_count++] = (max+min-TEST_RANGE)/2+i;	test_vals[test_count++] = random_val(min, max);    }    return test_count;}/* Test a function with zero arguments */static int test_0_arg(funct_t f, funct_t ft, char *name, int report){    int r = f();    int rt = ft();    int error =  (r != rt);    if (error && report)	printf("Test %s() failed.\n  Gives %d[0x%x].  Should be %d[0x%x]\n",	       name, r, r, rt, rt);    return error;}/* Test a function with one argument */static int test_1_arg(funct_t f, funct_t ft, int arg1, char *name, int report){    funct1_t f1 = (funct1_t) f;    funct1_t f1t = (funct1_t) ft;    int r, rt, error;    r = f1(arg1);    rt = f1t(arg1);    error = (r != rt);    if (error && report)	printf("Test %s(%d[0x%x]) failed.\n  Gives %d[0x%x].  Should be %d[0x%x]\n",	       name, arg1, arg1, r, r, rt, rt);    return error;}/* Test a function with two arguments */static int test_2_arg(funct_t f, funct_t ft, 		      int arg1, int arg2, 		      char *name, int report){    funct2_t f2 = (funct2_t) f;    funct2_t f2t = (funct2_t) ft;    int r = f2(arg1, arg2);    int rt = f2t(arg1, arg2);    int error = (r != rt);    if (error && report)	printf(	       "Test %s(%d[0x%x],%d[0x%x]) failed.\n  Gives %d[0x%x].  Should be %d[0x%x]\n",	       name, arg1, arg1, arg2, arg2, r, r, rt, rt);    return error;}/* Test a function with three arguments */static int test_3_arg(funct_t f, funct_t ft,	   int arg1, int arg2, int arg3,	   char *name, int report){    funct3_t f3 = (funct3_t) f;    funct3_t f3t = (funct3_t) ft;    int r = f3(arg1, arg2, arg3);    int rt = f3t(arg1, arg2, arg3);    int error = (r != rt);    if (error && report)	printf(	       "Test %s(%d[0x%x],%d[0x%x],%d[0x%x]) failed.\n  Gives %d[0x%x].  Should be %d[0x%x]\n",	       name, arg1, arg1, arg2, arg2, arg3, arg3, r, r, rt, rt);    return error;}/* Test a function.  Return number of errors */static int test_function(test_ptr t, int report) {    int test_vals[3][TEST_COUNT];    int test_counts[3];    int errors = 0;    int i;    int a1, a2, a3;    int args = t->args;    /* Create test set */    for (i = 0; i < 3; i++)	test_counts[i] =	    gen_vals(test_vals[i], t->arg_ranges[i][0], t->arg_ranges[i][1]);    if (args == 0) {	errors += test_0_arg(t->solution_funct, t->test_funct,			     t->name, report && errors < error_limit);    } else for (a1 = 0; a1 < test_counts[0]; a1++) {	if (args == 1) {	    errors += test_1_arg(t->solution_funct, t->test_funct,				 test_vals[0][a1],				 t->name, report && errors < error_limit);	} else for (a2 = 0; a2 < test_counts[1]; a2++) {	    if (args == 2) {		errors += test_2_arg(t->solution_funct, t->test_funct,				     test_vals[0][a1], test_vals[1][a2],				     t->name, report && errors < error_limit);	    } else for (a3 = 0; a3 < test_counts[2]; a3++) {		errors += test_3_arg(t->solution_funct, t->test_funct,				     test_vals[0][a1], test_vals[1][a2],				     test_vals[2][a3],				     t->name, report && errors < error_limit);	    }	}    }    if (!grade) {	if (report && errors > error_limit)	    printf("... %d total errors for function %s\n",		   errors, t->name);    }    return errors;}/* Run series of tests.  Return number of errors */ static int run_tests(int report) {    int i;    int errors = 0;    double points = 0.0;    double max_points = 0.0;    if (grade)	printf("Score\tErrors\tFunction\n");    for (i = 0; test_set[i].solution_funct; i++) {	int terrors;	double tscore;	double tpoints;	if (!test_fname || strcmp(test_set[i].name,test_fname) == 0) {	    int rating = global_rating ? global_rating : test_set[i].rating;	    terrors = test_function(&test_set[i], report);	    errors += terrors;	    if (test_set[i].args == 0)		tscore = terrors == 0 ? 1.0 : 0.0;	    else		tscore = terrors == 0 ? 1.0 : terrors == 1 ? 0.5 : 0.0;	    tpoints = rating * tscore;	    points += tpoints;	    max_points += rating;	    if (grade)		printf(" %.1f\t%d\t%s\n", tpoints, terrors, test_set[i].name);	    if (report)		printf("Test %s score: %.2f/%.2f\n",		       test_set[i].name, tpoints, (double) rating);	}    }    if (grade) 	printf("Total points: %.2f/%.2f\n", points, max_points);    else	printf("Overall correctness score: %.2f/%.2f\n", points, max_points);    return errors;}static void usage(char *cmd) {    printf("Usage: %s [-v 0|1] [-hag] [-f <func name>] [-e <max errors>]\n", cmd);    printf("  -e <n>    Limit number of errors to report for single function to n\n");    printf("  -f <name> Check only the named function\n");    printf("  -g        Print compact grading summary (implies -v 0 and -e 0)\n");    printf("  -h        Print this message\n");    printf("  -a        Omit check for valid info struct\n");    printf("  -r <n>    Give uniform weight of n for all problems\n");    printf("  -v <n>    Set verbosity to level n\n");    printf("               n=0: Only give final scores\n");    printf("               n=1: Also report individual correctness scores (default)\n");    exit(1);}/*  * main routine  */int main(int argc, char *argv[]){    int verbose_level = 1;    int errors;    int info_check = 1;    char c;    /* parse command line args */     while ((c = getopt(argc, argv, "hagv:f:e:r:")) != -1)        switch (c) {        case 'h': /* help */	    usage(argv[0]);	    break;        case 'a': /* Don't check info structure */	    info_check = 0;	    break;        case 'g': /* grading summary */	    grade = 1;	    break;        case 'v': /* set verbosity level */	    verbose_level = atoi(optarg);	    if (verbose_level < 0 || verbose_level > 1)		usage(argv[0]);	    break;	case 'f': /* test only one function */	    test_fname = strdup(optarg);	    break;	case 'e': /* set error limit */	    error_limit = atoi(optarg);	    if (error_limit < 0)		usage(argv[0]);	    break;	case 'r': /* set global rating for each problem */	    global_rating = atoi(optarg);	    if (global_rating < 0)		usage(argv[0]);	    break;	default:	    usage(argv[0]);    }
    if (grade) {	  error_limit = 0;	  verbose_level = 0;    }    if (info_check) {      /* Students must fill in their identifying info */      if ((*info.name == '\0')) {	printf("%s: ERROR.  You must fill in the name member of the info_struct in bits.c!\n", argv[0]);	exit(1);      }       if ((*info.id == '\0')) {	printf("%s: ERROR.  You must fill in the id member of the info_struct in bits.c!\n", argv[0]);	exit(1);      }     }    /* test each function */    errors = run_tests(verbose_level > 0);    if (!grade) {	if (errors > 0)	    printf("%d errors encountered.\n", errors);	else {	    printf("All tests passed.\n");	}    }    return 0;}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
美国毛片一区二区三区| 国产欧美一区二区三区在线老狼| 国产一区二区电影| 久久99精品久久久久久国产越南 | 欧美一区二区高清| 日韩一区和二区| 日韩欧美在线不卡| xnxx国产精品| 国产女同互慰高潮91漫画| 国产午夜亚洲精品不卡| 中文在线一区二区| 亚洲欧美日韩国产另类专区| 亚洲卡通欧美制服中文| 亚洲成人自拍网| 青草国产精品久久久久久| 日韩不卡一二三区| 国产剧情一区二区三区| 99精品久久只有精品| 欧美视频一区在线| 日韩免费观看2025年上映的电影| 2021久久国产精品不只是精品| 欧美极品少妇xxxxⅹ高跟鞋| 日韩毛片视频在线看| 亚洲国产精品久久一线不卡| 久久99精品久久久久久| 福利电影一区二区| 欧美日韩美少妇| 欧美精品一区二区精品网| 中文字幕日本乱码精品影院| 亚洲一级二级在线| 国产成人精品1024| 在线观看欧美精品| 久久综合网色—综合色88| 中文字幕亚洲区| 免费不卡在线观看| 91免费视频观看| 精品电影一区二区三区| 亚洲美女视频在线观看| 日本欧美一区二区三区乱码| 不卡的av中国片| 9191国产精品| 亚洲人午夜精品天堂一二香蕉| 秋霞成人午夜伦在线观看| 成av人片一区二区| 久久综合久色欧美综合狠狠| 一区二区成人在线视频| 国产高清亚洲一区| 91精品国产综合久久久蜜臀粉嫩 | 一区二区三区在线高清| 蜜臀91精品一区二区三区| 色婷婷综合久久久久中文一区二区| 日韩欧美国产小视频| 亚洲乱码国产乱码精品精的特点 | 国产成人av自拍| 欧美一级午夜免费电影| 亚洲三级免费观看| 国产成人精品影视| 91精品国产乱| 亚洲成人免费电影| 一本大道久久a久久综合| 国产情人综合久久777777| 日韩av一区二区三区四区| 91丨porny丨国产入口| 欧美激情在线免费观看| 麻豆精品新av中文字幕| 精品视频资源站| 亚洲高清视频在线| 欧美日韩国产一级片| 夜夜精品视频一区二区| 91激情五月电影| 一区二区三区精品在线观看| 成人精品国产福利| 国产精品卡一卡二| 成人av动漫在线| 18欧美乱大交hd1984| 91丨九色丨蝌蚪丨老版| 国产精品短视频| 91理论电影在线观看| 亚洲欧美国产毛片在线| 在线观看国产一区二区| 亚洲国产一区二区视频| 欧美精品色一区二区三区| 日韩精品亚洲专区| 26uuu成人网一区二区三区| 国产主播一区二区三区| 国产精品午夜久久| 99久久精品免费观看| 亚洲一区二区三区爽爽爽爽爽| 欧美三级中文字幕在线观看| 午夜精品123| 26uuu亚洲| 99精品视频在线观看免费| 亚洲国产视频一区| 精品国精品国产| 成人午夜免费av| 亚洲精品久久久久久国产精华液| 欧美性感一类影片在线播放| 日本人妖一区二区| 中文av字幕一区| 欧美日韩不卡视频| 国产一区二区三区精品欧美日韩一区二区三区 | 国产精品久久久久7777按摩| 91美女精品福利| 奇米精品一区二区三区在线观看一| 久久久久久久久久久久电影| av电影天堂一区二区在线| 视频一区二区中文字幕| 日本一二三四高清不卡| 在线免费观看日韩欧美| 国产麻豆精品一区二区| 一区二区三区在线视频免费观看| 日韩欧美一级二级三级| 91影院在线观看| 精品在线播放免费| 亚洲一区二区三区精品在线| 2023国产精品| 欧美三级视频在线观看| 高清shemale亚洲人妖| 午夜成人免费电影| 亚洲四区在线观看| 国产亚洲成aⅴ人片在线观看| 欧美午夜一区二区三区免费大片| 国产在线精品视频| 天天综合网 天天综合色| 亚洲日穴在线视频| 国产亚洲综合在线| 日韩精品自拍偷拍| 欧美日韩精品福利| 色88888久久久久久影院按摩| 国产精品夜夜嗨| 青青草国产精品亚洲专区无| 亚洲精品免费看| 日韩理论片中文av| 中文字幕av一区 二区| 日韩免费观看高清完整版 | 精品久久久久av影院| 欧美日韩国产综合草草| 99久久精品费精品国产一区二区| 韩国女主播成人在线观看| 日本在线播放一区二区三区| 亚洲一区二区三区在线播放| 亚洲欧美激情一区二区| 亚洲欧美影音先锋| 欧美国产乱子伦| 国产女主播在线一区二区| 久久久蜜桃精品| 久久看人人爽人人| 国产日产欧美一区| 国产精品区一区二区三区| 欧美国产激情二区三区| 亚洲国产成人自拍| 中文字幕中文字幕在线一区 | 91视频免费播放| 色成人在线视频| 欧美综合久久久| 精品视频在线看| 91精品黄色片免费大全| 欧美一区二区美女| 精品福利av导航| 日本一区二区三区高清不卡 | 91精品欧美福利在线观看| 在线不卡欧美精品一区二区三区| 欧美日韩精品是欧美日韩精品| 欧美精品18+| 日韩一区二区三区免费观看| 日韩欧美国产一区二区三区| 久久在线免费观看| 中文字幕一区二区三区不卡在线| 最新中文字幕一区二区三区| 亚洲精品国产高清久久伦理二区 | 欧美精品v国产精品v日韩精品| 欧美美女bb生活片| 久久嫩草精品久久久久| 欧美国产日韩精品免费观看| 亚洲欧美另类图片小说| 亚洲国产成人av网| 蜜桃视频在线观看一区| 国产激情视频一区二区在线观看 | 青青草国产精品97视觉盛宴| 久久99国产精品久久| 粉嫩欧美一区二区三区高清影视 | 首页欧美精品中文字幕| 精品午夜久久福利影院| 99久久综合精品| 欧美酷刑日本凌虐凌虐| 久久女同互慰一区二区三区| 亚洲蜜臀av乱码久久精品 | 97se亚洲国产综合在线| 欧美一区二区三区在线看| 欧美激情自拍偷拍| 日韩综合小视频| 成人aaaa免费全部观看| 欧美一级日韩一级| 亚洲三级在线看| 国内精品免费在线观看| 欧美色大人视频| 国产精品久久久久久亚洲毛片 | 成人国产免费视频| 日韩欧美一区电影| 亚洲国产aⅴ天堂久久|