Exercise Computing the cyclomatic complexity Philippe CHARMAN Last update: 05-15-2014.

Slides:



Advertisements
Similar presentations
Chapter 6 Path Testing Software Testing
Advertisements

Review of Inheritance. 2 Several Levels of Inheritance Base Class B Derived class D Derived class D1.
1 Class Vehicle #include #define N 10../.. 2 Class Vehicle class vehicle { public: float speed; char colour[N+1]; char make[N+1];
PASSING PARAMETERS 1. 2 Parameter Passing (by Value) Parameters Formal Parameters – parameters listed in the header of the function Variables used within.
Exercise Exercise3.1 8 Exercise3.1 9 Exercise
Exercise Exercise Exercise Exercise
Exercise Exercise Exercise Exercise
Exercise Exercise6.1 7 Exercise6.1 8 Exercise6.1 9.
BASIS PATH TESTING ● By Tom McCabe ● McCabe, T., "A Software Complexity Measure," IEEE Trans. Software Engineering, vol. SE-2, December 1976, pp
1 Session-9 CSIT 121 Spring 2006 Lab Demo (first 20 minutes) The correct way to do the previous lab sheet Function calls Calling void functions Calling.
1 10/30/06CS150 Introduction to Computer Science 1 Functions Chapter 3, page 313.
Examples from “c++ how to program” book. SELECTIONS WITH IF-ELSE Example: if ( grade >= 60) cout = 60) cout
Exercise Variation of the Weinberg-Myers Triangle Problem
C++ Basics CSci 107. A C++ program //include headers; these are modules that include functions that you may use in your //program; we will almost always.
Cyclomatic Complexity Dan Fleck Fall 2009 Dan Fleck Fall 2009.
String Constructors string str; // creates an empty //string string str(“abc”); // creates a string // from a C-string string str(aString); // creates.
Object-oriented programming: C++ class A { private: …… // can be accessd by A protected: …… // can be accessed by A and // its derived classes public:
CS1201: Programming Language 2 Recursion By: Nouf Almunyif.
computer
SEARCHING (Linear/Binary). Searching Algorithms  method of locating a specific item of information in a larger collection of data.  two popular search.
Some of the best books of  &mid= A23D2FC75CD A23D2FC75CD7.
Value and Reference Parameters. CSCE 1062 Outline  Summary of value parameters  Summary of reference parameters  Argument/Parameter list correspondence.
COMPUTER PROGRAMMING. Iteration structures (loops) There may be a situation when you need to execute a block of code several number of times. In general,
1 Looping. 2 Chapter 6 Topics  While Statement Syntax  Phases of Loop Execution  Two Types of Loops: Count-Controlled Loops &Event-Controlled Loops.
Tracing through E01, question 9 – step 1 // p02.cc P. Conrad, for CISC181 07S // Exam question for E01 #include using namespace std; void mysteryFunction(int.
For loops, nested loops and scopes Jordi Cortadella Department of Computer Science.
Data Structures & Algorithms
Module 4: I/O and Strings #1 2000/01Scientific Computing in OOCourse code 3C59 Module 4: I/O In this module we will cover Keyboard/screen input and output.
Lecture 4 Function example. Example1 int max (int a, int b) { int c; if (a > b) c = a; else c = b; return (c); } void main ( ) {int x, y; cin>>x>>y; cout.
Instructor - C. BoyleFall Semester
1 Associative Containers Ordered Ordered Unordered UnorderedSets Maps as sets of pairs Set API Ex: Sieve of Eratosthenes Ex: Sieve of EratosthenesImplementation.
Review. Problem 1 What is the output of the following piece of code void increment(int x) { x++; } int main() { int y = 10; increment(y); cout
Cyclomatic Complexity Philippe CHARMAN Last update:
Software Testing Techniques Presented By Dr. Shazzad Hosain.
 Learn how to form strings using one-dimensional array  String manipulation functions:  strcpy  strrev  strcmp  Program using strings.
Int fact (int n) { If (n == 0) return 1; else return n * fact (n – 1); } 5 void main () { Int Sum; : Sum = fact (5); : } Factorial Program Using Recursion.
ANOOP GANGWAR 5 TH SEM SOFTWARE TESTING MASTER OF COMPUTER APPLICATION-V Sem.
for( 起始條件 ; 判斷式 ; 條件運算 ){ // 迴圈內容 } while( 判斷式 ){ // 迴圈內容 } do{ // 迴圈內容 } while( 判斷式 ) ;
Basic concepts of C++ Presented by Prof. Satyajit De
Cyclomatic Complexity
#define #include<iostream> using namespace std; #define GO
Doubly Linked List Review - We are writing this code
For loops, nested loops and scopes
Sketching the Derivative
Structural testing, Path Testing
Cyclomatic Complexity
Cyclomatic Complexity
Cyclomatic Complexity
Cs212: Data Structures Computer Science Department Lab 7: Stacks.
Introduction to Programming
Pointers & Functions.
Cyclomatic Complexity
Cs212: DataStructures Computer Science Department Lab 3 : Recursion.
CS150 Introduction to Computer Science 1
Cyclomatic Complexity
CS1201: Programming Language 2
C++ Pointers and Strings
Statements and flow control
CS150 Introduction to Computer Science 1
Drawing Graphs The parabola x Example y
Pointers & Functions.
The Stack.
Lab – 2018/04/12 implement getTotalCount to return how many ‘nMatrix’s are allocated(exist) (modify constructor and destructor, use static variable and.
C++ Basics CSci 107. A C++ program //include headers; these are modules that include functions that you may use in your //program; we will almost always.
Functions Divide and Conquer
CS150 Introduction to Computer Science 1
C++ Pointers and Strings
1. Cyclomatic complexity
Line Graphs.
Presentation transcript:

Exercise Computing the cyclomatic complexity Philippe CHARMAN Last update:

Exercise Draw the control flow graph of the following function What is the value of its cyclomatic complexity Use another method to compute it and check the value is the same

void Library::RemoveSubscriber(int code_sub) { Position pos = SubList.getHeadPostition(); while (pos) { if (code_sub == SubList.getAt(pos).getCode()) { if (SubList.getAt(pos).getExpirationDate() == 0) { if (SubList.getAt(pos).getBooks() == 0) { SubList.getAt(pos).removeSubscriber(); cout << “The subscriber has been removed” << endl; return; } else { cout << “Books must be returned first” << endl; return; } else { cout << “The subscriber is already removed” << endl; return; } else { SubList.getNext(pos); } cout << “This subscriber doesn’t exist” << endl; }