Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Suppose that a developer needs to test a function (named, compdate ) that compares dates with the following specification: int compdate (int year1 , int

Suppose that a developer needs to test a function (named, compdate) that compares dates with the following specification:

int compdate(int year1, int month1, int day1, int year2, int month2, int day2);

/* compdate returns 0 if date1 = date2, -1 if date1 before date2, 1 if date1 after date2, -2 if any element of any date is invalid; valid years are all integers (<0 >

The developer decides to use a random testing scheme to test the compdate function, and also decides to run 200 tests where each test is performed by the following function:

int randomtest_compdate() {

int i;

for (i=0; i<200; i++){ int y1 = random_int(); /* returns a random 32 bit value */ int y2 = random_int(); int m1 = (random_int() % 11) + 1; int m2 = (random_int() % 11) + 1; int d1 = (random_int() % 30) + 1; int d2 = (random_int() % 30) + 1; int c = compdate(y1,m1,d1,y2,m2,d2); oracle(y1,m1,d1,y2,m2,d2,c);

}

}

Assuming that oracle function does a good job of checking compdates correctness:

Discuss the random testing approach and propose how to improve it (at least three improvements).

For each improvement, explain the weakness of the original scheme.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 22nd European Conference Adbis 2018 Budapest Hungary September 2 5 2018 Proceedings Lncs 11019

Authors: Andras Benczur ,Bernhard Thalheim ,Tomas Horvath

1st Edition

3319983970, 978-3319983974

More Books

Students also viewed these Databases questions

Question

Explain how to build high-performance service delivery teams.

Answered: 1 week ago

Question

Understand what a service-oriented culture is.

Answered: 1 week ago