Due - Sunday, February 23, 2025
This is a group project of 2 or 3 students per group. The groups can be found in the document Assignment2_Groups.docx.
White box testing, also known as clear box testing, glass box testing, or structural testing, is a software testing technique that focuses on the internal structures or workings of a software application. The primary goal of white box testing is to ensure that all the internal components, paths, and conditions are correctly implemented and work as expected. This assignment contains exercises in white box testing.
//StandardDev.cpp - Code for calculating the standard deviation // // 02-Jan-24 M. Watler Created. #includeThe code can also be seen at StandardDev.cpp.void main(argc, argv) { int no_numbers; /* The number of numbers for which std dev is to be calculated */ float mean, stdev; / *temporary variables * / int i, total; /* temporary variables */ int numbers[100]; /* the actual numbers */ do { printf("Please enter the number of numbers \n"); scanf("%d", &no_numbers); if (no_numbers < 2) printf("Invalid number of numbers, try again...\n"); } while (no_numbers < 2); /* First accept the numbers and calculate their sum as we go along */ for (i = 0; i < no_numbers; i++) ( scanf("%d", &numbers[i]); total += numbers[i]; } mean = total / no_numbers; /* now start calculating standard deviation */ total = 0; for (i = 0; i < no_numbers; i++) { total += ((mean - numbers[i]) * (mean - numbers[i])) } stdev = total / no_numbers; printf("The standard deviation is %d\n", stdev); return (0); }
/* definition of the list is assumed to be given by the following structure: struct llist { int value; llist * next; llist * prev; } The caller is supposed to pass a pointer to the start of the llist and the value to be deleted; There is assumed to be at most one value to be deleted */ void delete_list (llist * list, int value_to_be_deleted) { llist* temp; for (temp = list; temp != NULL, temp = temp->next) { if (temp->value == value_to_be_deleted) if (temp->prev ! = NULL) temp->prev->next = temp->next; if (temp->next ! = NULL) temp->next->prev = temp->prev; return (0); } return (1); /* value to be deleted is not found at the end of search */ }The code can also be seen at DoublyLinkedList.cpp.
int month_days [13]= {0, 31, 28, 31, 30, 31, 30, 31, 31,30, 31, 30, 31 }; valid = TRUE; if (is_leap-year(yy)) month_days [2] = 29; if (mm < 1 !! mm > 12) valid = FALSE; else if (day < 1 !! day> month_days[mm]) valid = FALSE; else if (year < 1) valid = FALSE; return (valid); /* In the above, the function is_leap-year is defined as follows */ int is_leap-year (int year) { int result; if ((year%4) != 0 ) result = FALSE; else if (( year %400) == 0) result = TRUE; else if ((year %100) == 0) result = FALSE; return (result); }Date Validation - Part b
//return 0 - success, return -1 - failure if (!(dd > 0 && dd < 32)) { printf ("enter a number between 1 and 32 only\n"); return (-1); } if ((mm=4) !! (mm==6) !! (mm==9) !! (mm==11)) & day> 30) { printf ("invalid date; maximum days should be 30"); return (-1); } if (((year%100==0) || (year%4==0)||(year%400==0)) && (day==29))||(day < 29)) { printf ("valid date \n"); return (0); } else { printf("invalid date\n"); return (-1); }The code can also be seen at DateValidation.cpp.
You will be marked out of 10 according to the following:
Does not meet expectations | Satisfactory | Good | Exceeds Expectations | |
---|---|---|---|---|
Calculating Standard Deviation (3 marks) | Does not meet requirements | Meets the most important requirements | Meets all requirements with minor errors | Meets all requirements with no errors |
Deleting Elements of a Doubly Linked List (2 marks) | Does not meet requirements | Meets the most important requirements | Meets all requirements with minor errors | Meets all requirements with no errors |
Date Validation (3 marks) | Does not meet requirements | Meets the most important requirements | Meets all requirements with minor errors | Meets all requirements with no errors |
Questions (2 marks) | Does not meet requirements | Meets the most important requirements | Meets all requirements with minor errors | Meets all requirements with no errors |
Please email all source code and answers to questions to: miguel.watler@senecapolytechnic.ca
Your answers to questions can be submitted in a separate document or embedded within your source code.
You will be docked 10% if your assignment is submitted 1-2 days late.
You will be docked 20% if your assignment is submitted 3-4 days late.
You will be docked 30% if your assignment is submitted 5-6 days late.
You will be docked 40% if your assignment is submitted 7 days late.
You will be docked 50% if your assignment is submitted over 7 days late.