From 64e7c6bcd13a100212d33e946fcff02e022e03d5 Mon Sep 17 00:00:00 2001 From: Alessandro Ferro <49845537+xfarrow@users.noreply.github.com> Date: Wed, 9 Jun 2021 08:44:47 +0200 Subject: [PATCH] Library 5 Added functionality in mytests --- librerie/exercise5/zmytest/test.cpp | 110 +++++++++++++++++----------- librerie/exercise5/zmytest/test.hpp | 5 +- 2 files changed, 71 insertions(+), 44 deletions(-) diff --git a/librerie/exercise5/zmytest/test.cpp b/librerie/exercise5/zmytest/test.cpp index 0eef580..50aabc8 100755 --- a/librerie/exercise5/zmytest/test.cpp +++ b/librerie/exercise5/zmytest/test.cpp @@ -113,13 +113,14 @@ void IntegerFunctions(T& mtx){ std::cout<<"Choose one of the following options:"< "; std::cin>>std::ws; std::cin>>choice; @@ -129,28 +130,31 @@ void IntegerFunctions(T& mtx){ PrintElements(mtx); break; case 2: - CheckExistence(mtx); + CheckExistenceOfElement(mtx); break; case 3: - ProductsElementsLessThan(mtx); + CheckExistenceOfCell(mtx); break; case 4: - Double(mtx); + ProductsElementsLessThan(mtx); break; case 5: - Insert(mtx); + Double(mtx); break; case 6: - Read(mtx); + Insert(mtx); break; case 7: - Resize(mtx); + Read(mtx); break; case 8: + Resize(mtx); + break; + case 9: menu(); break; } - }while(choice!=8 && choice!=9); + }while(choice!=9 && choice!=10); } template @@ -193,13 +197,14 @@ void FloatFunctions(T& mtx){ std::cout<<"Choose one of the following options:"< "; std::cin>>std::ws; std::cin>>choice; @@ -209,28 +214,31 @@ void FloatFunctions(T& mtx){ PrintElements(mtx); break; case 2: - CheckExistence(mtx); + CheckExistenceOfElement(mtx); break; case 3: - SumElementsGreaterThan(mtx); + CheckExistenceOfCell(mtx); break; case 4: - CubeElements(mtx); + SumElementsGreaterThan(mtx); break; case 5: - Insert(mtx); + CubeElements(mtx); break; case 6: - Read(mtx); + Insert(mtx); break; case 7: - Resize(mtx); + Read(mtx); break; case 8: + Resize(mtx); + break; + case 9: menu(); break; } - }while(choice!=8 && choice!=9); + }while(choice!=9 && choice!=10); } template @@ -273,13 +281,14 @@ void StringFunctions(T& mtx){ std::cout<<"Choose one of the following options:"< "; std::cin>>std::ws; std::cin>>choice; @@ -289,28 +298,31 @@ void StringFunctions(T& mtx){ PrintElements(mtx); break; case 2: - CheckExistence(mtx); + CheckExistenceOfElement(mtx); break; case 3: - ConcatLessThan(mtx); + CheckExistenceOfCell(mtx); break; case 4: - HeadConcat(mtx); + ConcatLessThan(mtx); break; case 5: - Insert(mtx); + HeadConcat(mtx); break; case 6: - Read(mtx); + Insert(mtx); break; case 7: - Resize(mtx); + Read(mtx); break; case 8: + Resize(mtx); + break; + case 9: menu(); break; } - }while(choice!=8 && choice!=9); + }while(choice!=9 && choice!=10); } template @@ -351,6 +363,18 @@ void HeadConcatMapAux(string& data, void* par){ /* ----- shared functions ----- */ +template +void CheckExistenceOfCell(T& mtx){ + ulong row,column; + cout<<"\n\n Check existence in the matrix of the cell with coordinates: \n"; + cout<<" Row: "; + cin>>row; + cout<<" Column: "; + cin>>column; + + cout<<" The cell " << ( (mtx.ExistsCell(row,column))? "does" : "does not") << " exist\n\n"; +} + template void Resize(T& mtx){ ulong rows, columns; @@ -401,7 +425,7 @@ void Insert(T& mtx){ } template