DS Lab 1 Task+updated

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

National University of Computer & Emerging Sciences (NUCES),

Islamabad Department of Computer Science

CS201: Data Structures (Fall 2018)

In this lab we will practice Gunit testing and 2D array.

You have to implement a Matrix Multiplication. In this you have given two text file in which
attributes for implementing Matrix Multiplication is given that are:

1) No. of Rows and No. of Columns (2D Array) separated with space.
2) Row wise Matrix Element) separated with space.
Example
Matrix1.txt Matrix2.txt
33 32
123 456
456 767
789

Create two matrix objects using these text files. And apply matrix multiplication.

Method definition you will be going to provide:

Matrix1* matrixMul(Matrix1 *& matrix2)

Test Cases:

1. Write test case which checks number of rows and number of columns of matrix1 using
“EXPECT_EQ”.
2. Write test case which checks number of rows and number of columns of matrix2 using
“EXPECT_EQ”.
3. Write test case which multiply matrix1 and matrix 2 and then checks number of rows and
number of columns of resultmatrix row and col using “EXPECT_EQ”.
4. Write test case which checks the first element of resultmatrix after multiplication.

Notes:
 Use these attributes in your matrix class.
a. int** matrix
b. int number_of_rows
c. int number_of_columns
 Create constructer of matrix class which receives path of the matrix file.

You might also like