Please don't, if you are up here, become complacent because a month from now we will have another test.
如果你考得不错的话,请不要自满,因为在一个月后我们将还有一次测试。
I've got a really bad grade on my test.
我在一门测试中考了一个很差的成绩。
And it's hard to imagine a simpler program than this. So we very quickly realize that exhaustive testing is just never feasible for an interesting program.
更简单的程序了,因此我们很快的意识到,对一个程序来说详尽的,测试是永远不可行的。
And then it has a beautiful illustration of psychological testing, so I'll give you them quickly one after the other.
也很好地解释了一个心理测试,我会很快为大家逐一讲解。
I know that your teaching fellows will have handed out a meter exercise for you.
我知道助教们会,发给你们一个韵律测试。
And each proposes to Socrates a test that he will have to pass in order to prove the value of justice and the just life.
每一个建议对苏格拉底都是一次必需通过的测试,以证明,正义与公正人生的价值。
So it's really a training ground for the final paper, and we have found that people don't succeed in the course in the final paper without the training they get in section discussion, which is why section participation is worth ten percent of your grade.
所以讨论课也是为期末测试而训练的一个基础部分,我们曾发现没有在讨论课上的训练学生是没法,通过期末考试的,这也是为什么讨论课,的出勤率占你们分数的百分之十的原因。
Besides that--okay,let's take a quiz first.
另外。。。让我们先进行一个小测试。
This is not really a quiz cause we're not going to collect it.
这不是一个正式的测试,因为我不会把它们收上来
Now I'm going to give you another little pop quiz here.
现在,我想再进行一个小测试
Why do I give you a test?
我为什么要给你一个测试?
For instance in the past, we had that silly little program for computing the average of some quizzes and it was actually a pretty bad implementation because I had essentially hard coded in the number of quizzes.
比如在以前,我们做了一个,计算平均数的程序,这是一个相当挫的实现,因为我硬编码了测试的数字。
So when I was out of school, mom sent me to take an exam, IQ exam.
这之后,我妈妈送我去做一个测试,是一个智商的测试。
OK, not a quiz for points or anything, don't freak out, but I do want you to tell me who these people are. So, what about this person?
我们的课程将由一个小测试开始,别紧张,这不记录分数的,但我希望你们能告诉我这些人是谁?
A test suite that will make us feel good about things. For now, I just want you to be aware that you're always doing this balancing act.
测试集呢?一个测试集会让我们的工作,变的舒服多了,现在,我只是想让,大家意识到你们经常需要做这种协调工作。
Imagine you have a math test and this is the front of the math test.
假设要做一个数学测试,这是数学测试卷的正面。
I should really just put it in a nice test harness, where I run 100, 200, 1,000 trials, but I didn't want to bore you with that here.
我应该把它放到一个测试组件中,我运行100次,200次,1000次,但是我现在不想用这个来烦你们。
And check the answers, and say yeah that's what we expected. But it also involves reasoning. About why that's an appropriate set of inputs to test it on it.
然后说对,这就是我想要的结果,但是它跟推理也有关系,表现在关于为什么这是一个,测试我们程序的适合的输入集。
Let's check it out. I've written a little bit of a test script here, so if we test cell sort, and I've written this so that it's going to print out what the list is at the end of each round, OK.
我们来检查检查,我写了一个小测试脚本,我写这个脚本来测试单元排序,它能够打印出每一轮结束后,链表的是什么样子的。
So we'll see that, OK, we passed the first smoke test.
所以我们会看到,我们通过了第一个发烟测试。
First one, when I write a piece of code, especially code that has branches in it, when I design test cases for that piece of code, I should try and have a specific test case for each possible path through the code.
第一点,当我们写代码的时候,尤其是一些含有分支语句的代码的时候,当我为这些代码,设计测试用例的时候,我应该为每一个可能的程序路径,都设计一个特别的用例。
All right. Second question: or maybe a better way of saying this, and the general format you're likely to see here is, a test involving a variable name, which must be initialized outside of the loop, and which interior to the loop gets changed, so that the test is going to change.
好,第二个问题:,换种更好的方式来说吧,你们通常喜欢的,方式是,这个测试涉及到一个变量名字,变量在循环外已经被初始化,然后循环内部会改变这个变量的值,因此测试结果会改变。
Do something until an end test is true.
做点儿事情直到最后一个测试也是真的。
I have the freedom to pass that person because I like the trend. Suppose I have somebody else who came here with two years of chemistry in high school, got a 95 on the first test, 70 on the second test, failed the third test, failed the final, has an aggregate score of 48.
我能够选择让那人通过,因为我喜欢他的进步,假设另一个同学,学了2年的化学在高中,第一次测试得到95分,第二次70分,第三次没通过,期末考也没通过。
Another little pop quiz here, and these aren't trick questions necessarily, but if you had to guess what the bigger problem was in the developing world, so let's not just say outside the U.S.
我们再做一个小测试,这不是什么难题,你们猜猜,发展中国家面临最大的问题是什么,我们所说的不是美国以外的国家
Here's another little quiz.
我们再做一个小测试
I can build class stock, and I can test class stock, before I have a class market.
我可以建立一个stock类,然后在有macket类之前测试这个类。
I'm doing a test there to say, x if the string x is less than the value of b, and x does not appear before b as strings, then I was going to do, oh, a couple of things, because they're at the same block level.
我正在做一个测试来看看,字符串,是不是小于b的值,而且x不在b之前作为字符串出现,如果是真的话我就要做,一系列的操作,因为他们是在同一个块等级上。
What I am talking about today, I will not be testing you, but maybe you might pay attention because about a month from now we will ask you a few skill testing questions about it.
我说的是今天,我等会不会测试你,但是你可能会重视了,因为一个月之前,我们问了你关于一些测试的技能。
And it's just gathering together the multiplications while counting down the exponent. And you can see it when we get down to the end test here, we're going to pop out of there and we're going to return the answer.
这个方法就是通过乘法,来一个一个的减小指数,可以看到,最后面的结果测试,我们会在这里退出,然后返回答案。
应用推荐