5
CUTE Homework CS294-32

CUTE Homework

Embed Size (px)

DESCRIPTION

CUTE Homework. CS294-32. Assignment. Due Noon 02/06/2009 Arrange to give me a demo on Monday 02/09/2009 after 1 pm Your Program: Trace -> Input You must compute overall branch coverage. Sample Program. #include #include int dbl(int x) { return 2 * x; } void f(){ - PowerPoint PPT Presentation

Citation preview

Page 1: CUTE Homework

CUTE Homework

CS294-32

Page 2: CUTE Homework

Assignment• Due Noon 02/06/2009• Arrange to give me a demo on

Monday 02/09/2009 after 1 pm• Your Program: Trace -> Input• You must compute overall branch

coverage

Page 3: CUTE Homework

#include <stdio.h>#include <cute.h>

int dbl(int x) { return 2 * x;

}void f(){

int x; int y;CUTE_integer(x);CUTE_integer(y);

printf("x=%d y=%d\n",x,y);int z = dbl(x);if(z==y){

if(x != y+10){printf("I am fine here\n");

} else {printf("I should not reach here\n");

}}

}

Sample Program

Page 4: CUTE Homework

• (2280624,_) = (0,_) • (2280640,_) = (0,4) • (2280620,_) = (0,_) • (2280636,_) = (0,8) • (2280616,_) = (0,_) • (2280612,_) = (0,_) • (2280608,_) = (0,4210688) • (2280640,_) = (int)(x1,_) • (2280604,_) = (0,_) • (2280600,_) = (0,_) • (2280596,_) = (0,4210688) • (2280636,_) = (int)(x2,_) • (2280592,_) = (0,_) • (2280588,_) = (2280640,0) • (2280584,_) = (0,_) • (2280580,_) = (2280636,0) • (2280576,_) = (0,_)

• (2280572,_) = (2280640,0) • (2280528,_) = (2280572,_) • (2280628,_) = (0,2) * (2280528,0) • (2280632,_) = (2280628,0) • (2280568,_) = (0,_) • (2280564,_) = (2280636,0) • then:1 (2280632,0) ==

(2280564,0) • (2280560,_) = (0,_) • (2280556,_) = (2280636,0) • (2280552,_) = (2280556,0) +

(0,10) • (2280548,_) = (0,_) • (2280544,_) = (2280640,0) • then:3 (2280544,0) !=

(2280552,10)

Sample Trace

Page 5: CUTE Homework

sat(= x1 -10) (= x2 -20)

Sample Input