From c0030c5a2056df155af07cf10c77b9c8a7725e23 Mon Sep 17 00:00:00 2001 From: B Kleinen Date: Wed, 18 Apr 2012 22:57:52 +0200 Subject: [PATCH] koans ready --- CPPKoans.sdf | Bin 8998912 -> 8998912 bytes CPPKoans/AboutAssert.cpp | 10 +++++----- CPPKoans/AboutBitwiseOperators.cpp | 22 ++++++++++---------- CPPKoans/AboutClasses.cpp | 12 +++++------ CPPKoans/AboutControlStructures.cpp | 12 +++++------ CPPKoans/AboutDataTypes.cpp | 17 ++++++++-------- CPPKoans/AboutErrorHandling.cpp | 2 +- CPPKoans/AboutFunctionCalls.cpp | 8 ++++---- CPPKoans/AboutPointers.cpp | 2 +- CPPKoans/AboutStrings.cpp | 30 ++++++++++++++-------------- CPPKoans/AboutUserDefinedTypes.cpp | 2 +- CPPKoans/Assert.h | 5 ++++- scripts/replace_expectations.rb | 9 ++++++++- 13 files changed, 69 insertions(+), 62 deletions(-) diff --git a/CPPKoans.sdf b/CPPKoans.sdf index 86e537696f91e8cf2469b09af51e4bbcd4d2df1a..02c3674172b1bcd4cad4937df4f6358873ce6d0a 100755 GIT binary patch delta 16739 zcmeHu33L-jwrF*?)KbfmELrj*Z<4^0z<_OG1h&D841^?XR)(-7KqL%=#TW?;7z|h< zV3?UCSU{+RVX;{BC%a7`Js}BL1VR!>uo9L4VXz2+Y$R6ZJ+hl$-7T564NTs9XXefS zXLQc3uBxtE)m3%tE_JWm4SNJ`1XN||TM~eN8@*Id{5sZ@^Ok)7t2zvJd;6x7ql2HCh*yPT8hHhvST&7l)`O7c`<$L^x zWWB%+Zqk$;`#zi6Hg93d0ICFhKvN3g_ae&OzWDskwD++X*s2lg;kOP$K6Gxyg;2Hy z7ei-~(4c%{fWK}R(*%tmLO?>t23!LVB?)UO?VPV)W8P8FxgFQTSsLMd;kkF_!(Fgq zJ8pnGlZ8dFI9Zr4{A8f^#LkY&CDhun_ibemNqFh=EIk~WBAiEE{Q2{3Or4PH?0kxF zAvvJ5&ze1HaAiSe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+TuH4^IMohat)V7Z zZLDstg3H>LI8f9bk(LSCoOqsG>jGX|wvGKut*wmrm`!1iQPQ)1TwWtO2gZ|KLLL%2 zZNi=-5r2Ar6?qmQ&v+`PteLtS6=D=CUlO zFvUdjO{lOsD~aKMD66xcCb0yC-d~!Pi~^#_Xw(*&EX2#JvO1Bx$bQAXroHyP`aP|? zm9OG$)mhVNuc4PhwFcJyz^nX|pQ-#bukvU94VClh1{*qdDLn~)c`3a{gh)^`sLxKO#kKOfBZ+jR5Xa}-ubMcXVmQ#sRLZZ9{^2u}Be)b5(o~b`}cMHKJh=>2l4x?Yu^X&`@TAz22H5-B}pv0 zcbp{RTJB6Oh%j$aqqbix?N#LHRCTKu8J~eU8^QmT^61(~*3CP}@>!TH^hJH1j8DZh z(?E?cZOhAKyrvw5%3Jo@>?x4}|s(cliP?axxRAF+v zOW?KTs8yFI9Bt-98`>{$Ys@B z?J~Xw(7r+B{-+9)Uw;w0V3tHde9E@Sy%2BTZ=6bVFqeaUIM|niPjE1ggZUgR;9x%v z7ILsZ2a7mZ%s~SOjU0TEg9AAD6bA=#@M#VX;^1HomT+(g2ZwTS7zax^SjNHO95ivz z%)t>He1?M~IXH@gqd7Q+gJU^3j)UVlIDvx`IXH=flQ}qrgOGz34o>CZG!9PZ;0z9y zb8sdHXL0aZ4pwk*HV3U7oWsGn9Gu5N8wc$ioX^1p99+o3MI5Z;;9?Fg;owpZF5_So l2bXiOnu9eQtmUACgH8^v;NWu{T*<*z9OO8-+6&jT{SU;chI#-1 diff --git a/CPPKoans/AboutAssert.cpp b/CPPKoans/AboutAssert.cpp index 8643170..ce92499 100755 --- a/CPPKoans/AboutAssert.cpp +++ b/CPPKoans/AboutAssert.cpp @@ -4,16 +4,16 @@ void aboutAssertParameterTypes(){ - expectThat("actual and expected need to be of the same type",3,3); - expectThat("however, if they are not the same, expected is tried to be cast to the actual type.",3.0,3); - expectThat("truncating information when casting to narrower type",3.1,3); + expectThat("actual and expected need to be of the same type",_____,3); + expectThat("however, if they are not the same, expected is tried to be cast to the actual type.",______,3); + expectThat("truncating information when casting to narrower type",______,3); expectThatNot("and not if casted to a wider type",3,3.1); expectThatNot("you won't get an Error for bad types","expected",42); //this causes a crash //expectThat("this is the error message you get when the cast failed",42,"expected"); - expectThat("thus, you can also compare c-strings with cpp-strings","cstring",string("cstring")); + expectThat("thus, you can also compare c-strings with cpp-strings",_______,string("cstring")); } void AboutAssert::meditate(){ aboutAssertParameterTypes(); -} \ No newline at end of file +} diff --git a/CPPKoans/AboutBitwiseOperators.cpp b/CPPKoans/AboutBitwiseOperators.cpp index 73ab61e..b1e6789 100755 --- a/CPPKoans/AboutBitwiseOperators.cpp +++ b/CPPKoans/AboutBitwiseOperators.cpp @@ -8,29 +8,29 @@ void aboutShiftOperators(){ // 1 looks like this: 0000000000000001 // now we can shift the set bit around unsigned short value = unsigned_one << 5; - expectThat("shifting to the left is like multiplying with 2^n",32,value); + expectThat("shifting to the left is like multiplying with 2^n",_____,value); value = value >> 1; - expectThat("shifting to the right divides by two",16,value); + expectThat("shifting to the right divides by two",_____,value); value = value << 12; - expectThat("careful though if out of bounds",0,value); + expectThat("careful though if out of bounds",_____,value); short signed_value = one << 15; - expectThat("and with the sign",-32768,signed_value); + expectThat("and with the sign",_____,signed_value); unsigned unsigned_integer = 1 << 15; - expectThat("1 shifted 15 to the left is...",32768,unsigned_integer); + expectThat("1 shifted 15 to the left is...",_____,unsigned_integer); short signed_short = short(unsigned_integer); expectThatRaw("and keep in mind things can happen when numbers are casted",short(-32768),signed_short); } void aboutOperators(){ - expectThat("| bitwise or",16,0|16); - expectThat("& bitwise and",1,255&1); + expectThat("| bitwise or",_____,0|16); + expectThat("& bitwise and",_____,255&1); unsigned fifthbitset = 1<<5; - expectThat("| can be used to set the nth bit",32,0|fifthbitset); - expectThat("& can be used to determine if the 5th bit is set like so",true,((255>>5)&1 == 1)); + expectThat("| can be used to set the nth bit",_____,0|fifthbitset); + expectThat("& can be used to determine if the 5th bit is set like so",________,((255>>5)&1 == 1)); - expectThat("^ bitwise XOR",6,3^5); - expectThat("~ bitwise negation",-4,~3); + expectThat("^ bitwise XOR",_____,3^5); + expectThat("~ bitwise negation",_____,~3); } void AboutBitwiseOperators::meditate() { diff --git a/CPPKoans/AboutClasses.cpp b/CPPKoans/AboutClasses.cpp index ca8ded4..63b4b06 100755 --- a/CPPKoans/AboutClasses.cpp +++ b/CPPKoans/AboutClasses.cpp @@ -44,14 +44,14 @@ void aboutMemberPolymorphism() { B b; A c = b; - expectThat("direct method call to a", 'a', a.method0()); - expectThat("b inherits method0 from a", 'a', b.method0()); - expectThat("direct method call to a", 'a', a.method1()); - expectThat("b overwrites method1", 'b', b.method1()); + expectThat("direct method call to a", ____, a.method0()); + expectThat("b inherits method0 from a", ____, b.method0()); + expectThat("direct method call to a", ____, a.method1()); + expectThat("b overwrites method1", ____, b.method1()); expectThat("unless declared as virtual, methods are statically bound", 'a', c.method1()); - expectThat("virtual method on b declared as B", 'b', b.method2()); - expectThat("virtual method on b declared as A", 'a', c.method2()); + expectThat("virtual method on b declared as B", ____, b.method2()); + expectThat("virtual method on b declared as A", ____, c.method2()); } void AboutClasses::meditate() { diff --git a/CPPKoans/AboutControlStructures.cpp b/CPPKoans/AboutControlStructures.cpp index abe18c7..9b90695 100755 --- a/CPPKoans/AboutControlStructures.cpp +++ b/CPPKoans/AboutControlStructures.cpp @@ -19,7 +19,7 @@ void aboutIfStatement() { } else { result = 2; } - expectThat("the if statement is just as in Java", 1, result); + expectThat("the if statement is just as in Java", _____, result); } void aboutIntegersTreatedAsBoolean() { int a = 5; @@ -28,7 +28,7 @@ void aboutIntegersTreatedAsBoolean() { if (a = b) { actual = true; } - expectThat("integers are treated as boolean!", true, actual); + expectThat("integers are treated as boolean!", ________, actual); } void aboutWhileLoop() { @@ -38,8 +38,7 @@ void aboutWhileLoop() { count++; ++j; } - expectThat("the while loop should have been run 100 times", 100, - count); + expectThat("the while loop should have been run 100 times", _____, count); } void aboutForLoop() { int count = 0; @@ -47,8 +46,7 @@ void aboutForLoop() { count++; } - expectThat("the for loop should have been run 100 times", 100, - count); + expectThat("the for loop should have been run 100 times", _____, count); } void aboutSwitchStatement() { const double cm_per_inch = 2.54; @@ -66,7 +64,7 @@ void aboutSwitchStatement() { result = -1; break; } - expectThat("it should have computed inch to cm", 2.54, result); + expectThat("it should have computed inch to cm", ______, result); } void AboutControlStructures::meditate() { aboutIfStatement(); diff --git a/CPPKoans/AboutDataTypes.cpp b/CPPKoans/AboutDataTypes.cpp index a25a38e..3ce52d1 100755 --- a/CPPKoans/AboutDataTypes.cpp +++ b/CPPKoans/AboutDataTypes.cpp @@ -13,41 +13,40 @@ AboutDataTypes::AboutDataTypes() { void aboutDataTypeSizes(){ char decimal_point = '.'; - expectThat("char is on 1 byte",1,sizeof(decimal_point)); + expectThat("char is on 1 byte",_____,sizeof(decimal_point)); int number = 0; - expectThat("integer is usually 32 bit",4,sizeof(number)); + expectThat("integer is usually 32 bit",_____,sizeof(number)); double flying_time = 2.9; - expectThat("double takes 8 byte ",8,sizeof(flying_time)); + expectThat("double takes 8 byte ",_____,sizeof(flying_time)); bool tap = true; - expectThat("boolean takes 1 byte ",1,sizeof(tap)); + expectThat("boolean takes 1 byte ",_____,sizeof(tap)); } void aboutSafeTypeConversions() { char c = 'a'; int i1 = c; - expectThat("converting char to int is save", 'a', (char)i1); + expectThat("converting char to int is save", ____, (char)i1); int i2 = 'a'; char c2 = i2; - expectThat("converting int to char works if value is small enough", - 'a', c2); + expectThat("converting int to char works if value is small enough", ____, c2); } void aboutUnsafeTypeConversions() { int a = 128; char c3 = a; // doesn't fit in char - char is signed -128..127 int b = c3; - expectThat("int is cut off when pressed into a char", -128, b); + expectThat("int is cut off when pressed into a char", _____, b); double d = 47.11; int i = d; double converted = i; - expectThat("double is cut off when assigned to int", 47.00,converted); + expectThat("double is cut off when assigned to int", ______,converted); } diff --git a/CPPKoans/AboutErrorHandling.cpp b/CPPKoans/AboutErrorHandling.cpp index fb933f6..6b79017 100755 --- a/CPPKoans/AboutErrorHandling.cpp +++ b/CPPKoans/AboutErrorHandling.cpp @@ -35,7 +35,7 @@ void aboutThrowingSomething() { result = 2; } - expectThat("arbitrary classes can be thrown", 2, result); + expectThat("arbitrary classes can be thrown", _____, result); } void AboutErrorHandling::meditate() { diff --git a/CPPKoans/AboutFunctionCalls.cpp b/CPPKoans/AboutFunctionCalls.cpp index cbf5d1a..ee6a876 100755 --- a/CPPKoans/AboutFunctionCalls.cpp +++ b/CPPKoans/AboutFunctionCalls.cpp @@ -22,8 +22,8 @@ void someFunction1(int x, int y){ void aboutPassingByValue(){ int a = 4711, b = 13; someFunction1(a,b); - expectThat("if parameters are passed by value, ...",4711,a); - expectThat("they are not changed in the outside context",13,b); + expectThat("if parameters are passed by value, ...",_____,a); + expectThat("they are not changed in the outside context",_____,b); } // pass by reference: just add a & void someFunction2(int x, int &y){ @@ -33,8 +33,8 @@ void someFunction2(int x, int &y){ void aboutPassingByReference(){ int a = 4711, b = 13; someFunction2(a,b); - expectThat("if parameters are passed by reference, ...",4711,a); - expectThat("they *are* changed in the outside context",14,b); + expectThat("if parameters are passed by reference, ...",_____,a); + expectThat("they *are* changed in the outside context",_____,b); } diff --git a/CPPKoans/AboutPointers.cpp b/CPPKoans/AboutPointers.cpp index 1eac5eb..bdad8c7 100755 --- a/CPPKoans/AboutPointers.cpp +++ b/CPPKoans/AboutPointers.cpp @@ -11,7 +11,7 @@ void aboutPointers(){ int i = 5; int *i_pointer = &i; - expectThat("pointers contain memory addresses - they are a reference to the variable",5,*i_pointer); + expectThat("pointers contain memory addresses - they are a reference to the variable",_____,*i_pointer); } void AboutPointers::meditate(){ aboutPointers(); diff --git a/CPPKoans/AboutStrings.cpp b/CPPKoans/AboutStrings.cpp index e2ca24e..7616e23 100755 --- a/CPPKoans/AboutStrings.cpp +++ b/CPPKoans/AboutStrings.cpp @@ -21,20 +21,20 @@ void aboutCStrings(){ char *x = aString; // and sizeof determines the size of the pointer! int pointerSize = sizeof(x); - expectThat("the size of a pointer",4,pointerSize); + expectThat("the size of a pointer",_____,pointerSize); // arrays in c don't store their length. // there is a method in cstring which determines it for strings looking for the terminating char. char anotherString[] ="0123456789"; int stringLength = strlen(anotherString); - expectThat("the length of the string is determined by looking for the null char",10,stringLength); + expectThat("the length of the string is determined by looking for the null char",_____,stringLength); } void aboutStringLiterals(){ // internally, a c-string is an array of chars terminated by the null character \0 // string literals - like "hello" - are short form for that. char hello1[] = {'h','e','l','l','o', '\0'}; char hello2[] = "hello"; - expectThat("those strings are the same",true,(strcmp(hello1,hello2) == 0)); + expectThat("those strings are the same",________,(strcmp(hello1,hello2) == 0)); } void aboutCPPStrings(){ // C++ has a string library @@ -42,23 +42,23 @@ void aboutCPPStrings(){ s = "big bang theory"; int l = s.length(); - expectThat("length returns the length of the string",15,l); + expectThat("length returns the length of the string",_____,l); - expectThat("elements can be accessed via [] as in arrays",'b',s[4]); + expectThat("elements can be accessed via [] as in arrays",____,s[4]); string s1 = "hello"; string s2 = "hello"; - expectThat("opposed to java, == works on C++ strings",true, s1 == s2); + expectThat("opposed to java, == works on C++ strings",________, s1 == s2); s[4] = 'B'; - expectThat("C++ strings are mutable.", string("big Bang theory"),s); + expectThat("C++ strings are mutable.", _______,s); } void aboutStringAssignmentCreatesACopy(){ string s1 = "hello"; string s2 = s1; s2[1] = 'a'; - expectThat("s1 is not changed",string("hello"),s1); - expectThat("but s2 of course is changed",string("hallo"),s2); + expectThat("s1 is not changed",_______,s1); + expectThat("but s2 of course is changed",_______,s2); } string mutateString(string s){ @@ -68,8 +68,8 @@ string mutateString(string s){ void aboutStringsAsParametersBeingCopied(){ string s1 = "hello"; string s2 = mutateString(s1); - expectThat("s1 is not changed by modification in function",string("hello"),s1); - expectThat("but the return value s2 contains the change",string("hallo"),s2); + expectThat("s1 is not changed by modification in function",_______,s1); + expectThat("but the return value s2 contains the change",_______,s2); } void mutateString(string *s_pointer){ *s_pointer = "Hullu"; @@ -79,19 +79,19 @@ void mutateString(string *s_pointer){ void aboutPassingAsReferenceMutatesTheOriginalString(){ string s1 = "hello"; mutateString(&s1); - expectThat("if passed by reference, the string is modified",string("Hullu"),s1); + expectThat("if passed by reference, the string is modified",_______,s1); } void aboutTheConcatenationPitfall(){ string s1 = "a "; - expectThat("+ if overloaded to do string concatenation on C++ strings.",string("a cat"),s1+"cat"); - expectThat("can also be used with chars.",string("a c"),s1+'c'); + expectThat("+ if overloaded to do string concatenation on C++ strings.",_______,s1+"cat"); + expectThat("can also be used with chars.",_______,s1+'c'); // however: "a "+"cat"; won't compile - they are both c-strings expectThatNot("this will compile, but not result in the expected",string("a c"),string("a "+'c')); char* s2 = "a123456789b123456789c"; - expectThat("in fact, it's a pointer manipulation II",string("6789c"),string(s2+16)); + expectThat("in fact, it's a pointer manipulation II",_______,string(s2+16)); } diff --git a/CPPKoans/AboutUserDefinedTypes.cpp b/CPPKoans/AboutUserDefinedTypes.cpp index 4915c0f..8c0d564 100755 --- a/CPPKoans/AboutUserDefinedTypes.cpp +++ b/CPPKoans/AboutUserDefinedTypes.cpp @@ -7,4 +7,4 @@ #include "stdafx.h" #include "AboutUserDefinedTypes.h" -void AboutUserDefinedTypes::meditate(){}; \ No newline at end of file +void AboutUserDefinedTypes::meditate(){}; diff --git a/CPPKoans/Assert.h b/CPPKoans/Assert.h index e85733b..164931c 100755 --- a/CPPKoans/Assert.h +++ b/CPPKoans/Assert.h @@ -43,7 +43,10 @@ template void expectThat (string message, T expected, U actual) { expectThatRaw(message+" (expected was casted to "+typeid(U).name()+")",U(expected),actual); } - +/* +void expectThat(string message,int expected, string actual){ + cout << "honeypot"; +}*/ template void expectThatNot (string message, T expected, T actual) { expectThatNotRaw(message,expected,actual); diff --git a/scripts/replace_expectations.rb b/scripts/replace_expectations.rb index c052561..1099e88 100755 --- a/scripts/replace_expectations.rb +++ b/scripts/replace_expectations.rb @@ -1,4 +1,11 @@ -require './replacer' +puts File.realpath(__FILE__) +require './scripts/replacer.rb' + + +# this line has been replaced with int _ instead of string: +# expectThat("in fact, it's a pointer manipulation II",_______,string(s2+16)); + + sourcedirname = "CPPKoans"