Question: use the c++ //File: string.cpp // //Version: 1.0 //Date: 9/5/2013 - Current Version Kent State University // //Author: Dr. J. Maletic // //Description: -Implementation of
use the c++


//File: string.cpp // //Version: 1.0 //Date: 9/5/2013 - Current Version Kent State University // //Author: Dr. J. Maletic // //Description: -Implementation of simple String class member functions. //
#include "string.hpp"
////////////////////////////////////////////////////////// // Default Constructor // ENSURES: str[0] == 0 // String::String() { str[0] = 0; }
////////////////////////////////////////////////////////// // ENSURES: str == s // Example: String("abcd") // String::String(const char *s) { int i = 0; while (s[i] != 0) { str[i] = s[i]; i++; if (i >= DEFAULT_STRING_CAPACITY-1) break; } str[i] = 0; }
////////////////////////////////////////////////////////// //Less Than // bool String::operator
inline bool operator
inline bool operator
#ifndef JM_NEWSTR_H_ #define JM_NEWSTR_H_
//File: string.h // //Version: 1.0 //Date: 9/5/2013 - Current Version Kent State University
//Author: Dr. J. Maletic // //Description: Class definition for a String. // // // Class: String // // Simple version with fixed sized array of char. // // Defines a character String data type with associated operators. // Examples: String a; //of capacity DEFAULT_STRING_CAPACITY // // - Strings are indexed from 0 to capacity-1 of char. // - a = ""; assigns a to the empty String.
#include
const int DEFAULT_STRING_CAPACITY = 256;
//////////////////////////////////////////////////// // CLASS INV: 0
bool operator
std::istream& operator>>(std::istream&, String&);
bool operator
#endif
############################################################### # String & Oracle # # CS II Kent State University # Make file for string class and testing oracle # J. Maletic 2015 # #
############################################################### # Variables CPP = clang++ OPTIONS = -g -Wall -W -Wunused -Wuninitialized -Wshadow -std=c++11
# Names of your test files - add them in as you build them. # Names must start with "test_" MYTESTS = test_default_ctor test_ctor_charArray
# Names of test oracle files CTOR = #testoracle_ctor_default testoracle_ctor_int testoracle_ctor_char testoracle_ctor_charArray_int testoracle_ctor_charArray REL = testoracle_lessThan COPY = testoracle_ctor_copy testoracle_assign OPS = testoracle_concat
############################################################### # Compile just the string # Compile and run all provided test oracles on string # Compile and run all your tests on string # Compile and run the project msg: @echo 'Targets are:' @echo ' string' @echo ' oracle' @echo ' tests' @echo ' justify' @echo ' clean'
############################################################### # Compile string # string.o: string.hpp string.cpp $(CPP) -c $(OPTIONS) string.cpp -o string.o
string: string.o
############################################################### # Run all of your tests # # You will need to ADD your other below: # For example: ./test_plus # tests: $(MYTESTS) ./test_default_ctor ./test_c_str_ctor #ADD YOUR TESTS HERE *************** ############################################################### # Compile all test programs # test_%: string.o test_%.o $(CPP) string.o test_$*.o -o test_$*
test_%.o: string.hpp test_%.cpp $(CPP) $(OPTIONS) -c test_$*.cpp
############################################################### # Run test oracle # Comment out one's you don't want. # oracle: $(CTOR) $(REL) $(COPY) $(OPS) ./testoracle_ctor_default ./testoracle_ctor_int ./testoracle_ctor_char ./testoracle_ctor_charArray ./testoracle_ctor_charArray_int ./testoracle_equal ./testoracle_lessThan ./testoracle_ctor_copy ./testoracle_assign ./testoracle_concat
############################################################### # Compile all test oracles # testoracle_%: string.o testoracles/testoracle_%.o $(CPP) string.o testoracles/testoracle_$*.o -o testoracle_$*
############################################################### # Compile Project #
justify.o: justify.cpp string.hpp $(CPP) -c $(OPTIONS) justify.cpp -o justify.o justify: justify.o string.o $(CPP) $(OPTIONS) justify.o string.o -o justify
############################################################### # clean # Removes all .o files and all executables # clean: rm -f *.o rm -f $(CTOR) $(REL) $(COPY) $(OPS) rm -f $(MYTESTS) rm -f justify
#include
int main (){
{
}
{
}
return 0; }
Lab Assignment 1- Create the directory testing_2 in your cs23001 folder, copy the files in testing_2 from the shared folder to your new directory the provided string.cpp and string.hpp should compile with no errors 2- Run the provided string.cpp and string.hpp against your test, and try to find the bug in the provided code and fix it 3- Use the provided oracles (in the shared folder) to find the bug and fix it Lab Assignment 1- Create the directory testing_2 in your cs23001 folder, copy the files in testing_2 from the shared folder to your new directory the provided string.cpp and string.hpp should compile with no errors 2- Run the provided string.cpp and string.hpp against your test, and try to find the bug in the provided code and fix it 3- Use the provided oracles (in the shared folder) to find the bug and fix it
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
