Refactor test code.

This commit is contained in:
Geoffrey Challen
2015-12-31 19:26:33 -05:00
parent 3b2267123d
commit 26612b6142
6 changed files with 191 additions and 114 deletions

View File

@@ -85,52 +85,29 @@ void stoplight_cleanup() {
}
void
gostraight(void *p, unsigned long direction)
turnright(unsigned long direction)
{
struct semaphore * stoplightMenuSemaphore = (struct semaphore *)p;
(void)direction;
/*
* Implement this function.
*/
/*
* This code allows the test to return to the menu cleanly.
*/
V(stoplightMenuSemaphore);
return;
}
void
turnleft(void *p, unsigned long direction)
gostraight(unsigned long direction)
{
struct semaphore * stoplightMenuSemaphore = (struct semaphore *)p;
(void)direction;
/*
* Implement this function.
*/
/*
* This code allows the test to return to the menu cleanly.
*/
V(stoplightMenuSemaphore);
return;
}
void
turnright(void *p, unsigned long direction)
turnleft(unsigned long direction)
{
struct semaphore * stoplightMenuSemaphore = (struct semaphore *)p;
(void)direction;
/*
* Implement this function.
*/
/*
* This code allows the test to return to the menu cleanly.
*/
V(stoplightMenuSemaphore);
return;
}

View File

@@ -59,58 +59,31 @@ whalemating_cleanup() {
}
void
male(void *p, unsigned long which)
male()
{
struct semaphore * whalematingMenuSemaphore = (struct semaphore *)p;
(void)which;
male_start();
/*
* Implement this function.
* Implement this function by calling male_start and male_end when
* appropriate.
*/
male_end();
/*
* This code allows the test to return to the menu cleanly.
*/
V(whalematingMenuSemaphore);
return;
}
void
female(void *p, unsigned long which)
female()
{
struct semaphore * whalematingMenuSemaphore = (struct semaphore *)p;
(void)which;
female_start();
/*
* Implement this function.
* Implement this function by calling female_start and female_end when
* appropriate.
*/
female_end();
/*
* This code allows the test to return to the menu cleanly.
*/
V(whalematingMenuSemaphore);
return;
}
void
matchmaker(void *p, unsigned long which)
matchmaker()
{
struct semaphore * whalematingMenuSemaphore = (struct semaphore *)p;
(void)which;
matchmaker_start();
/*
* Implement this function.
* Implement this function by calling matchmaker_start and matchmaker_end
* when appropriate.
*/
matchmaker_end();
/*
* This code allows the test to return to the menu cleanly.
*/
V(whalematingMenuSemaphore);
return;
}