diff --git a/.cproject b/.cproject deleted file mode 100644 index 2a934fb..0000000 --- a/.cproject +++ /dev/null @@ -1,262 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 96326ff..0000000 --- a/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -*.d -*.gcda -*.gcno -*.o -*.a -CSlim_tests -CSlim_cslim -libCSlim.a -*.gcov -gcov_*.txt* -CSlim_tests.txt -CSlim.tmproj -*.zip -*~ -*.obj -*.swp -*.exe -*.ilk -*.pdb -*.lib -build-cli diff --git a/.project b/.project deleted file mode 100644 index 5923076..0000000 --- a/.project +++ /dev/null @@ -1,76 +0,0 @@ - - - cslim - - - - - - org.eclipse.cdt.managedbuilder.core.genmakebuilder - - - ?name? - - - - org.eclipse.cdt.make.core.append_environment - true - - - org.eclipse.cdt.make.core.autoBuildTarget - all - - - org.eclipse.cdt.make.core.buildArguments - - - - org.eclipse.cdt.make.core.buildCommand - make - - - org.eclipse.cdt.make.core.cleanBuildTarget - clean - - - org.eclipse.cdt.make.core.contents - org.eclipse.cdt.make.core.activeConfigSettings - - - org.eclipse.cdt.make.core.enableAutoBuild - true - - - org.eclipse.cdt.make.core.enableCleanBuild - true - - - org.eclipse.cdt.make.core.enableFullBuild - true - - - org.eclipse.cdt.make.core.fullBuildTarget - all - - - org.eclipse.cdt.make.core.stopOnError - true - - - org.eclipse.cdt.make.core.useDefaultBuildCmd - true - - - - - org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder - - - - - - org.eclipse.cdt.core.cnature - org.eclipse.cdt.managedbuilder.core.ScannerConfigNature - org.eclipse.cdt.managedbuilder.core.managedBuildNature - - diff --git a/1k_slim_message.txt b/1k_slim_message.txt deleted file mode 100644 index 4b6b8a9..0000000 --- a/1k_slim_message.txt +++ /dev/null @@ -1 +0,0 @@ -001002:[000009:000085:[000004:000017:decisionTable_0_0:000004:make:000015:decisionTable_0:000008:Division:]:000214:[000005:000017:decisionTable_0_1:000004:call:000015:decisionTable_0:000005:table:000124:[000002:000062:[000003:000009:numerator:000011:denominator:000009:Quotient?:]:000037:[000003:000002:10:000001:5:000001:2:]:]:]:000087:[000004:000017:decisionTable_0_2:000004:call:000015:decisionTable_0:000010:beginTable:]:000082:[000004:000017:decisionTable_0_3:000004:call:000015:decisionTable_0:000005:reset:]:000099:[000005:000017:decisionTable_0_4:000004:call:000015:decisionTable_0:000012:setNumerator:000002:10:]:000100:[000005:000017:decisionTable_0_5:000004:call:000015:decisionTable_0:000014:setDenominator:000001:5:]:000084:[000004:000017:decisionTable_0_6:000004:call:000015:decisionTable_0:000007:execute:]:000085:[000004:000017:decisionTable_0_7:000004:call:000015:decisionTable_0:000008:Quotient:]:000085:[000004:000017:decisionTable_0_8:000004:call:000015:decisionTable_0:000008:endTable:]:] diff --git a/80k_slim_message.txt b/80k_slim_message.txt deleted file mode 100644 index fdf7fb9..0000000 --- a/80k_slim_message.txt +++ /dev/null @@ -1,2 +0,0 @@ -079733:[000734:000085:[000004:000017:decisionTable_0_0:000004:make:000015:decisionTable_0:000008:Division:]:006638:[000005:000017:decisionTable_0_1:000004:call:000015:decisionTable_0:000005:table:006548:[000147:000062:[000003:000009:numerator:000011:denominator:000009:Quotient?:]:000037:[000003:000002:10:000001:5:000001:2:]:000038:[000003:000002:55:000002:11:000001:5:]:000036:[000003:000001:1:000001:1:000001:1:]:000037:[000003:000002:10:000001:5:000001:2:]:000038:[000003:000002:55:000002:11:000001:5:]:000036:[000003:000001:1:000001:1:000001:1:]:000037:[000003:000002:10:000001:5:000001:2:]:000038:[000003:000002:55:000002:11:000001:5:]:000036:[000003:000001:1:000001:1:000001:1:]:000037:[000003:000002:10:000001:5:000001:2:]:000038:[000003:000002:55:000002:11:000001:5:]:000036:[000003:000001:1:000001:1:000001:1:]:000037:[000003:000002:10:000001:5:000001:2:]:000038:[000003:000002:55:000002:11:000001:5:]:000036:[000003:000001:1:000001:1:000001:1:]:000037:[000003:000002:10:000001:5:000001:2:]:000038:[000003:000002:55:000002:11:000001:5:]:000036:[000003:000001:1:000001:1:000001:1:]:000037:[000003:000002:10:000001:5:000001:2:]:000038:[000003:000002:55:000002:11:000001:5:]:000036:[000003:000001:1:000001:1:000001:1:]:000037:[000003:000002:10:000001:5:000001:2:]:000038:[000003:000002:55:000002:11:000001:5:]:000036:[000003:000001:1:000001:1:000001:1:]:000037:[000003:000002:10:000001:5:000001:2:]:000038:[000003:000002:55:000002:11:000001:5:]:000036:[000003:000001:1:000001:1:000001:1:]:000037:[000003:000002:10:000001:5:000001:2:]:000038:[000003:000002:55:000002:11:000001:5:]:000036:[000003:000001:1:000001:1:000001:1:]:000037:[000003:000002:10:000001:5:000001:2:]:000038:[000003:000002:55:000002:11:000001:5:]:000036:[000003:000001:1:000001:1:000001:1:]:000037:[000003:000002:10:000001:5:000001:2:]:000038:[000003:000002:55:000002:11:000001:5:]:000036:[000003:000001:1:000001:1:000001:1:]:000037:[000003:000002:10:000001:5:000001:2:]:000038:[000003:000002:55:000002:11:000001:5:]:000036:[000003:000001:1:000001:1:000001:1:]:000037:[000003:000002:10:000001:5:000001:2:]:000038:[000003:000002:55:000002:11:000001:5:]:000036:[000003:000001:1:000001:1:000001:1:]:000037:[000003:000002:10:000001:5:000001:2:]:000038:[000003:000002:55:000002:11:000001:5:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:000036:[000003:000001:1:000001:1:000001:1:]:]:]:000087:[000004:000017:decisionTable_0_2:000004:call:000015:decisionTable_0:000010:beginTable:]:000082:[000004:000017:decisionTable_0_3:000004:call:000015:decisionTable_0:000005:reset:]:000099:[000005:000017:decisionTable_0_4:000004:call:000015:decisionTable_0:000012:setNumerator:000002:10:]:000100:[000005:000017:decisionTable_0_5:000004:call:000015:decisionTable_0:000014:setDenominator:000001:5:]:000084:[000004:000017:decisionTable_0_6:000004:call:000015:decisionTable_0:000007:execute:]:000085:[000004:000017:decisionTable_0_7:000004:call:000015:decisionTable_0:000008:Quotient:]:000082:[000004:000017:decisionTable_0_8:000004:call:000015:decisionTable_0:000005:reset:]:000099:[000005:000017:decisionTable_0_9:000004:call:000015:decisionTable_0:000012:setNumerator:000002:55:]:000102:[000005:000018:decisionTable_0_10:000004:call:000015:decisionTable_0:000014:setDenominator:000002:11:]:000085:[000004:000018:decisionTable_0_11:000004:call:000015:decisionTable_0:000007:execute:]:000086:[000004:000018:decisionTable_0_12:000004:call:000015:decisionTable_0:000008:Quotient:]:000083:[000004:000018:decisionTable_0_13:000004:call:000015:decisionTable_0:000005:reset:]:000099:[000005:000018:decisionTable_0_14:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000101:[000005:000018:decisionTable_0_15:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000085:[000004:000018:decisionTable_0_16:000004:call:000015:decisionTable_0:000007:execute:]:000086:[000004:000018:decisionTable_0_17:000004:call:000015:decisionTable_0:000008:Quotient:]:000083:[000004:000018:decisionTable_0_18:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000018:decisionTable_0_19:000004:call:000015:decisionTable_0:000012:setNumerator:000002:10:]:000101:[000005:000018:decisionTable_0_20:000004:call:000015:decisionTable_0:000014:setDenominator:000001:5:]:000085:[000004:000018:decisionTable_0_21:000004:call:000015:decisionTable_0:000007:execute:]:000086:[000004:000018:decisionTable_0_22:000004:call:000015:decisionTable_0:000008:Quotient:]:000083:[000004:000018:decisionTable_0_23:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000018:decisionTable_0_24:000004:call:000015:decisionTable_0:000012:setNumerator:000002:55:]:000102:[000005:000018:decisionTable_0_25:000004:call:000015:decisionTable_0:000014:setDenominator:000002:11:]:000085:[000004:000018:decisionTable_0_26:000004:call:000015:decisionTable_0:000007:execute:]:000086:[000004:000018:decisionTable_0_27:000004:call:000015:decisionTable_0:000008:Quotient:]:000083:[000004:000018:decisionTable_0_28:000004:call:000015:decisionTable_0:000005:reset:]:000099:[000005:000018:decisionTable_0_29:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000101:[000005:000018:decisionTable_0_30:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000085:[000004:000018:decisionTable_0_31:000004:call:000015:decisionTable_0:000007:execute:]:000086:[000004:000018:decisionTable_0_32:000004:call:000015:decisionTable_0:000008:Quotient:]:000083:[000004:000018:decisionTable_0_33:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000018:decisionTable_0_34:000004:call:000015:decisionTable_0:000012:setNumerator:000002:10:]:000101:[000005:000018:decisionTable_0_35:000004:call:000015:decisionTable_0:000014:setDenominator:000001:5:]:000085:[000004:000018:decisionTable_0_36:000004:call:000015:decisionTable_0:000007:execute:]:000086:[000004:000018:decisionTable_0_37:000004:call:000015:decisionTable_0:000008:Quotient:]:000083:[000004:000018:decisionTable_0_38:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000018:decisionTable_0_39:000004:call:000015:decisionTable_0:000012:setNumerator:000002:55:]:000102:[000005:000018:decisionTable_0_40:000004:call:000015:decisionTable_0:000014:setDenominator:000002:11:]:000085:[000004:000018:decisionTable_0_41:000004:call:000015:decisionTable_0:000007:execute:]:000086:[000004:000018:decisionTable_0_42:000004:call:000015:decisionTable_0:000008:Quotient:]:000083:[000004:000018:decisionTable_0_43:000004:call:000015:decisionTable_0:000005:reset:]:000099:[000005:000018:decisionTable_0_44:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000101:[000005:000018:decisionTable_0_45:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000085:[000004:000018:decisionTable_0_46:000004:call:000015:decisionTable_0:000007:execute:]:000086:[000004:000018:decisionTable_0_47:000004:call:000015:decisionTable_0:000008:Quotient:]:000083:[000004:000018:decisionTable_0_48:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000018:decisionTable_0_49:000004:call:000015:decisionTable_0:000012:setNumerator:000002:10:]:000101:[000005:000018:decisionTable_0_50:000004:call:000015:decisionTable_0:000014:setDenominator:000001:5:]:000085:[000004:000018:decisionTable_0_51:000004:call:000015:decisionTable_0:000007:execute:]:000086:[000004:000018:decisionTable_0_52:000004:call:000015:decisionTable_0:000008:Quotient:]:000083:[000004:000018:decisionTable_0_53:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000018:decisionTable_0_54:000004:call:000015:decisionTable_0:000012:setNumerator:000002:55:]:000102:[000005:000018:decisionTable_0_55:000004:call:000015:decisionTable_0:000014:setDenominator:000002:11:]:000085:[000004:000018:decisionTable_0_56:000004:call:000015:decisionTable_0:000007:execute:]:000086:[000004:000018:decisionTable_0_57:000004:call:000015:decisionTable_0:000008:Quotient:]:000083:[000004:000018:decisionTable_0_58:000004:call:000015:decisionTable_0:000005:reset:]:000099:[000005:000018:decisionTable_0_59:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000101:[000005:000018:decisionTable_0_60:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000085:[000004:000018:decisionTable_0_61:000004:call:000015:decisionTable_0:000007:execute:]:000086:[000004:000018:decisionTable_0_62:000004:call:000015:decisionTable_0:000008:Quotient:]:000083:[000004:000018:decisionTable_0_63:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000018:decisionTable_0_64:000004:call:000015:decisionTable_0:000012:setNumerator:000002:10:]:000101:[000005:000018:decisionTable_0_65:000004:call:000015:decisionTable_0:000014:setDenominator:000001:5:]:000085:[000004:000018:decisionTable_0_66:000004:call:000015:decisionTable_0:000007:execute:]:000086:[000004:000018:decisionTable_0_67:000004:call:000015:decisionTable_0:000008:Quotient:]:000083:[000004:000018:decisionTable_0_68:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000018:decisionTable_0_69:000004:call:000015:decisionTable_0:000012:setNumerator:000002:55:]:000102:[000005:000018:decisionTable_0_70:000004:call:000015:decisionTable_0:000014:setDenominator:000002:11:]:000085:[000004:000018:decisionTable_0_71:000004:call:000015:decisionTable_0:000007:execute:]:000086:[000004:000018:decisionTable_0_72:000004:call:000015:decisionTable_0:000008:Quotient:]:000083:[000004:000018:decisionTable_0_73:000004:call:000015:decisionTable_0:000005:reset:]:000099:[000005:000018:decisionTable_0_74:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000101:[000005:000018:decisionTable_0_75:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000085:[000004:000018:decisionTable_0_76:000004:call:000015:decisionTable_0:000007:execute:]:000086:[000004:000018:decisionTable_0_77:000004:call:000015:decisionTable_0:000008:Quotient:]:000083:[000004:000018:decisionTable_0_78:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000018:decisionTable_0_79:000004:call:000015:decisionTable_0:000012:setNumerator:000002:10:]:000101:[000005:000018:decisionTable_0_80:000004:call:000015:decisionTable_0:000014:setDenominator:000001:5:]:000085:[000004:000018:decisionTable_0_81:000004:call:000015:decisionTable_0:000007:execute:]:000086:[000004:000018:decisionTable_0_82:000004:call:000015:decisionTable_0:000008:Quotient:]:000083:[000004:000018:decisionTable_0_83:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000018:decisionTable_0_84:000004:call:000015:decisionTable_0:000012:setNumerator:000002:55:]:000102:[000005:000018:decisionTable_0_85:000004:call:000015:decisionTable_0:000014:setDenominator:000002:11:]:000085:[000004:000018:decisionTable_0_86:000004:call:000015:decisionTable_0:000007:execute:]:000086:[000004:000018:decisionTable_0_87:000004:call:000015:decisionTable_0:000008:Quotient:]:000083:[000004:000018:decisionTable_0_88:000004:call:000015:decisionTable_0:000005:reset:]:000099:[000005:000018:decisionTable_0_89:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000101:[000005:000018:decisionTable_0_90:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000085:[000004:000018:decisionTable_0_91:000004:call:000015:decisionTable_0:000007:execute:]:000086:[000004:000018:decisionTable_0_92:000004:call:000015:decisionTable_0:000008:Quotient:]:000083:[000004:000018:decisionTable_0_93:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000018:decisionTable_0_94:000004:call:000015:decisionTable_0:000012:setNumerator:000002:10:]:000101:[000005:000018:decisionTable_0_95:000004:call:000015:decisionTable_0:000014:setDenominator:000001:5:]:000085:[000004:000018:decisionTable_0_96:000004:call:000015:decisionTable_0:000007:execute:]:000086:[000004:000018:decisionTable_0_97:000004:call:000015:decisionTable_0:000008:Quotient:]:000083:[000004:000018:decisionTable_0_98:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000018:decisionTable_0_99:000004:call:000015:decisionTable_0:000012:setNumerator:000002:55:]:000103:[000005:000019:decisionTable_0_100:000004:call:000015:decisionTable_0:000014:setDenominator:000002:11:]:000086:[000004:000019:decisionTable_0_101:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_102:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_103:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_104:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_105:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_106:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_107:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_108:000004:call:000015:decisionTable_0:000005:reset:]:000101:[000005:000019:decisionTable_0_109:000004:call:000015:decisionTable_0:000012:setNumerator:000002:10:]:000102:[000005:000019:decisionTable_0_110:000004:call:000015:decisionTable_0:000014:setDenominator:000001:5:]:000086:[000004:000019:decisionTable_0_111:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_112:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_113:000004:call:000015:decisionTable_0:000005:reset:]:000101:[000005:000019:decisionTable_0_114:000004:call:000015:decisionTable_0:000012:setNumerator:000002:55:]:000103:[000005:000019:decisionTable_0_115:000004:call:000015:decisionTable_0:000014:setDenominator:000002:11:]:000086:[000004:000019:decisionTable_0_116:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_117:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_118:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_119:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_120:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_121:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_122:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_123:000004:call:000015:decisionTable_0:000005:reset:]:000101:[000005:000019:decisionTable_0_124:000004:call:000015:decisionTable_0:000012:setNumerator:000002:10:]:000102:[000005:000019:decisionTable_0_125:000004:call:000015:decisionTable_0:000014:setDenominator:000001:5:]:000086:[000004:000019:decisionTable_0_126:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_127:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_128:000004:call:000015:decisionTable_0:000005:reset:]:000101:[000005:000019:decisionTable_0_129:000004:call:000015:decisionTable_0:000012:setNumerator:000002:55:]:000103:[000005:000019:decisionTable_0_130:000004:call:000015:decisionTable_0:000014:setDenominator:000002:11:]:000086:[000004:000019:decisionTable_0_131:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_132:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_133:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_134:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_135:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_136:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_137:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_138:000004:call:000015:decisionTable_0:000005:reset:]:000101:[000005:000019:decisionTable_0_139:000004:call:000015:decisionTable_0:000012:setNumerator:000002:10:]:000102:[000005:000019:decisionTable_0_140:000004:call:000015:decisionTable_0:000014:setDenominator:000001:5:]:000086:[000004:000019:decisionTable_0_141:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_142:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_143:000004:call:000015:decisionTable_0:000005:reset:]:000101:[000005:000019:decisionTable_0_144:000004:call:000015:decisionTable_0:000012:setNumerator:000002:55:]:000103:[000005:000019:decisionTable_0_145:000004:call:000015:decisionTable_0:000014:setDenominator:000002:11:]:000086:[000004:000019:decisionTable_0_146:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_147:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_148:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_149:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_150:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_151:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_152:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_153:000004:call:000015:decisionTable_0:000005:reset:]:000101:[000005:000019:decisionTable_0_154:000004:call:000015:decisionTable_0:000012:setNumerator:000002:10:]:000102:[000005:000019:decisionTable_0_155:000004:call:000015:decisionTable_0:000014:setDenominator:000001:5:]:000086:[000004:000019:decisionTable_0_156:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_157:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_158:000004:call:000015:decisionTable_0:000005:reset:]:000101:[000005:000019:decisionTable_0_159:000004:call:000015:decisionTable_0:000012:setNumerator:000002:55:]:000103:[000005:000019:decisionTable_0_160:000004:call:000015:decisionTable_0:000014:setDenominator:000002:11:]:000086:[000004:000019:decisionTable_0_161:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_162:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_163:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_164:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_165:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_166:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_167:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_168:000004:call:000015:decisionTable_0:000005:reset:]:000101:[000005:000019:decisionTable_0_169:000004:call:000015:decisionTable_0:000012:setNumerator:000002:10:]:000102:[000005:000019:decisionTable_0_170:000004:call:000015:decisionTable_0:000014:setDenominator:000001:5:]:000086:[000004:000019:decisionTable_0_171:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_172:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_173:000004:call:000015:decisionTable_0:000005:reset:]:000101:[000005:000019:decisionTable_0_174:000004:call:000015:decisionTable_0:000012:setNumerator:000002:55:]:000103:[000005:000019:decisionTable_0_175:000004:call:000015:decisionTable_0:000014:setDenominator:000002:11:]:000086:[000004:000019:decisionTable_0_176:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_177:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_178:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_179:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_180:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_181:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_182:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_183:000004:call:000015:decisionTable_0:000005:reset:]:000101:[000005:000019:decisionTable_0_184:000004:call:000015:decisionTable_0:000012:setNumerator:000002:10:]:000102:[000005:000019:decisionTable_0_185:000004:call:000015:decisionTable_0:000014:setDenominator:000001:5:]:000086:[000004:000019:decisionTable_0_186:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_187:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_188:000004:call:000015:decisionTable_0:000005:reset:]:000101:[000005:000019:decisionTable_0_189:000004:call:000015:decisionTable_0:000012:setNumerator:000002:55:]:000103:[000005:000019:decisionTable_0_190:000004:call:000015:decisionTable_0:000014:setDenominator:000002:11:]:000086:[000004:000019:decisionTable_0_191:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_192:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_193:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_194:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_195:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_196:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_197:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_198:000004:call:000015:decisionTable_0:000005:reset:]:000101:[000005:000019:decisionTable_0_199:000004:call:000015:decisionTable_0:000012:setNumerator:000002:10:]:000102:[000005:000019:decisionTable_0_200:000004:call:000015:decisionTable_0:000014:setDenominator:000001:5:]:000086:[000004:000019:decisionTable_0_201:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_202:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_203:000004:call:000015:decisionTable_0:000005:reset:]:000101:[000005:000019:decisionTable_0_204:000004:call:000015:decisionTable_0:000012:setNumerator:000002:55:]:000103:[000005:000019:decisionTable_0_205:000004:call:000015:decisionTable_0:000014:setDenominator:000002:11:]:000086:[000004:000019:decisionTable_0_206:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_207:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_208:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_209:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_210:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_211:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_212:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_213:000004:call:000015:decisionTable_0:000005:reset:]:000101:[000005:000019:decisionTable_0_214:000004:call:000015:decisionTable_0:000012:setNumerator:000002:10:]:000102:[000005:000019:decisionTable_0_215:000004:call:000015:decisionTable_0:000014:setDenominator:000001:5:]:000086:[000004:000019:decisionTable_0_216:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_217:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_218:000004:call:000015:decisionTable_0:000005:reset:]:000101:[000005:000019:decisionTable_0_219:000004:call:000015:decisionTable_0:000012:setNumerator:000002:55:]:000103:[000005:000019:decisionTable_0_220:000004:call:000015:decisionTable_0:000014:setDenominator:000002:11:]:000086:[000004:000019:decisionTable_0_221:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_222:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_223:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_224:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_225:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_226:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_227:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_228:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_229:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_230:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_231:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_232:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_233:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_234:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_235:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_236:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_237:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_238:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_239:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_240:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_241:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_242:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_243:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_244:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_245:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_246:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_247:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_248:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_249:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_250:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_251:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_252:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_253:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_254:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_255:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_256:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_257:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_258:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_259:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_260:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_261:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_262:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_263:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_264:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_265:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_266:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_267:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_268:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_269:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_270:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_271:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_272:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_273:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_274:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_275:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_276:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_277:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_278:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_279:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_280:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_281:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_282:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_283:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_284:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_285:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_286:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_287:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_288:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_289:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_290:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_291:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_292:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_293:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_294:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_295:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_296:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_297:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_298:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_299:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_300:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_301:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_302:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_303:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_304:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_305:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_306:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_307:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_308:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_309:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_310:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_311:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_312:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_313:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_314:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_315:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_316:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_317:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_318:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_319:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_320:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_321:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_322:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_323:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_324:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_325:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_326:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_327:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_328:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_329:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_330:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_331:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_332:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_333:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_334:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_335:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_336:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_337:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_338:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_339:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_340:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_341:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_342:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_343:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_344:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_345:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_346:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_347:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_348:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_349:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_350:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_351:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_352:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_353:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_354:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_355:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_356:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_357:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_358:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_359:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_360:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_361:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_362:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_363:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_364:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_365:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_366:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_367:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_368:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_369:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_370:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_371:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_372:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_373:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_374:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_375:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_376:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_377:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_378:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_379:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_380:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_381:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_382:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_383:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_384:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_385:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_386:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_387:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_388:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_389:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_390:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_391:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_392:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_393:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_394:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_395:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_396:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_397:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_398:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_399:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_400:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_401:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_402:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_403:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_404:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_405:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_406:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_407:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_408:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_409:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_410:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_411:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_412:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_413:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_414:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_415:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_416:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_417:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_418:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_419:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_420:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_421:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_422:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_423:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_424:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_425:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_426:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_427:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_428:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_429:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_430:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_431:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_432:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_433:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_434:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_435:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_436:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_437:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_438:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_439:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_440:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_441:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_442:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_443:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_444:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_445:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_446:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_447:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_448:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_449:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_450:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_451:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_452:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_453:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_454:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_455:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_456:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_457:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_458:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_459:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_460:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_461:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_462:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_463:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_464:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_465:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_466:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_467:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_468:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_469:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_470:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_471:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_472:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_473:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_474:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_475:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_476:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_477:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_478:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_479:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_480:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_481:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_482:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_483:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_484:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_485:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_486:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_487:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_488:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_489:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_490:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_491:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_492:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_493:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_494:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_495:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_496:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_497:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_498:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_499:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_500:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_501:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_502:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_503:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_504:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_505:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_506:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_507:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_508:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_509:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_510:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_511:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_512:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_513:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_514:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_515:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_516:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_517:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_518:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_519:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_520:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_521:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_522:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_523:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_524:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_525:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_526:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_527:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_528:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_529:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_530:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_531:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_532:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_533:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_534:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_535:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_536:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_537:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_538:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_539:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_540:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_541:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_542:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_543:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_544:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_545:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_546:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_547:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_548:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_549:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_550:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_551:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_552:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_553:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_554:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_555:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_556:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_557:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_558:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_559:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_560:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_561:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_562:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_563:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_564:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_565:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_566:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_567:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_568:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_569:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_570:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_571:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_572:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_573:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_574:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_575:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_576:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_577:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_578:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_579:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_580:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_581:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_582:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_583:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_584:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_585:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_586:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_587:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_588:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_589:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_590:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_591:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_592:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_593:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_594:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_595:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_596:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_597:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_598:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_599:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_600:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_601:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_602:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_603:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_604:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_605:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_606:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_607:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_608:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_609:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_610:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_611:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_612:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_613:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_614:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_615:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_616:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_617:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_618:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_619:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_620:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_621:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_622:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_623:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_624:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_625:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_626:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_627:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_628:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_629:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_630:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_631:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_632:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_633:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_634:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_635:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_636:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_637:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_638:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_639:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_640:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_641:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_642:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_643:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_644:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_645:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_646:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_647:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_648:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_649:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_650:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_651:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_652:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_653:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_654:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_655:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_656:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_657:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_658:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_659:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_660:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_661:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_662:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_663:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_664:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_665:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_666:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_667:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_668:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_669:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_670:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_671:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_672:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_673:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_674:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_675:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_676:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_677:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_678:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_679:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_680:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_681:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_682:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_683:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_684:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_685:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_686:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_687:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_688:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_689:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_690:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_691:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_692:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_693:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_694:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_695:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_696:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_697:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_698:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_699:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_700:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_701:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_702:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_703:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_704:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_705:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_706:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_707:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_708:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_709:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_710:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_711:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_712:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_713:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_714:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_715:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_716:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_717:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_718:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_719:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_720:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_721:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_722:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_723:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_724:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_725:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_726:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_727:000004:call:000015:decisionTable_0:000008:Quotient:]:000084:[000004:000019:decisionTable_0_728:000004:call:000015:decisionTable_0:000005:reset:]:000100:[000005:000019:decisionTable_0_729:000004:call:000015:decisionTable_0:000012:setNumerator:000001:1:]:000102:[000005:000019:decisionTable_0_730:000004:call:000015:decisionTable_0:000014:setDenominator:000001:1:]:000086:[000004:000019:decisionTable_0_731:000004:call:000015:decisionTable_0:000007:execute:]:000087:[000004:000019:decisionTable_0_732:000004:call:000015:decisionTable_0:000008:Quotient:]:000087:[000004:000019:decisionTable_0_733:000004:call:000015:decisionTable_0:000008:endTable:]:] -SIGTERM \ No newline at end of file diff --git a/Arduino.mk b/Arduino.mk deleted file mode 100644 index 8178c5c..0000000 --- a/Arduino.mk +++ /dev/null @@ -1,453 +0,0 @@ -######################################################################## -# -# Arduino command line tools Makefile -# System part (i.e. project independent) -# -# Copyright (C) 2010 Martin Oldfield , based on work that is -# Copyright Nicholas Zambetti, David A. Mellis & Hernando Barragan -# -# This file is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as -# published by the Free Software Foundation; either version 2.1 of the -# License, or (at your option) any later version. -# -# Adapted from Arduino 0011 Makefile by M J Oldfield -# -# Original Arduino adaptation by mellis, eighthave, oli.keller -# -# Version 0.1 17.ii.2009 M J Oldfield -# -# 0.2 22.ii.2009 M J Oldfield -# - fixes so that the Makefile actually works! -# - support for uploading via ISP -# - orthogonal choices of using the Arduino for -# tools, libraries and uploading -# -# 0.3 21.v.2010 M J Oldfield -# - added proper license statement -# - added code from Philip Hands to reset -# Arduino prior to upload -# -# 0.4 25.v.2010 M J Oldfield -# - tweaked reset target on Philip Hands' advice -# -# 0.5 23.iii.2011 Stefan Tomanek -# - added ad-hoc library building -# 17.v.2011 M J Oldfield -# - grabbed said version from Ubuntu -# -# 0.6 22.vi.2011 M J Oldfield -# - added ard-parse-boards supports -# - added -lc to linker opts, -# on Fabien Le Lez's advice -# -######################################################################## -# -# STANDARD ARDUINO WORKFLOW -# -# Given a normal sketch directory, all you need to do is to create -# a small Makefile which defines a few things, and then includes this one. -# -# For example: -# -# ARDUINO_DIR = /Applications/arduino-0013 -# -# TARGET = CLItest -# ARDUINO_LIBS = LiquidCrystal -# -# BOARD_TAG = uno -# ARDUINO_PORT = /dev/cu.usb* -# -# include /usr/local/share/Arduino.mk -# -# Hopefully these will be self-explanatory but in case they're not: -# -# ARDUINO_DIR - Where the Arduino software has been unpacked -# TARGET - The basename used for the final files. Canonically -# this would match the .pde file, but it's not needed -# here: you could always set it to xx if you wanted! -# ARDUINO_LIBS - A list of any libraries used by the sketch (we assume -# these are in $(ARDUINO_DIR)/hardware/libraries -# ARDUINO_PORT - The port where the Arduino can be found (only needed -# when uploading -# BOARD_TAG - The ard-parse-boards tag for the board e.g. uno or mega -# 'make show_boards' shows a list -# -# You might also want to specify these, but normally they'll be read from the -# boards.txt file i.e. implied by BOARD_TAG -# -# MCU,F_CPU - The target processor description -# -# Once this file has been created the typical workflow is just -# -# $ make upload -# -# All of the object files are created in the build-cli subdirectory -# All sources should be in the current directory and can include: -# - at most one .pde file which will be treated as C++ after the standard -# Arduino header and footer have been affixed. -# - any number of .c, .cpp, .s and .h files -# -# Included libraries are built in the build-cli/libs subdirectory. -# -# Besides make upload you can also -# make - no upload -# make clean - remove all our dependencies -# make depends - update dependencies -# make reset - reset the Arduino by tickling DTR on the serial port -# make raw_upload - upload without first resetting -# make show_boards - list all the boards defined in boards.txt -# -######################################################################## -# -# ARDUINO WITH OTHER TOOLS -# -# If the tools aren't in the Arduino distribution, then you need to -# specify their location: -# -# AVR_TOOLS_PATH = /usr/bin -# AVRDUDE_CONF = /etc/avrdude/avrdude.conf -# -######################################################################## -# -# ARDUINO WITH ISP -# -# You need to specify some details of your ISP programmer and might -# also need to specify the fuse values: -# -# ISP_PROG = -c stk500v2 -# ISP_PORT = /dev/ttyACM0 -# -# You might also need to set the fuse bits, but typically they'll be -# read from boards.txt, based on the BOARD_TAG variable: -# -# ISP_LOCK_FUSE_PRE = 0x3f -# ISP_LOCK_FUSE_POST = 0xcf -# ISP_HIGH_FUSE = 0xdf -# ISP_LOW_FUSE = 0xff -# ISP_EXT_FUSE = 0x01 -# -# I think the fuses here are fine for uploading to the ATmega168 -# without bootloader. -# -# To actually do this upload use the ispload target: -# -# make ispload -# -# -######################################################################## -# Some paths -# - -ifneq (ARDUINO_DIR,) - -ifndef AVR_TOOLS_PATH -AVR_TOOLS_PATH = $(ARDUINO_DIR)/hardware/tools/avr/bin -endif - -ifndef ARDUINO_ETC_PATH -ARDUINO_ETC_PATH = $(ARDUINO_DIR)/hardware/tools/avr/etc -endif - -ifndef AVRDUDE_CONF -AVRDUDE_CONF = $(ARDUINO_ETC_PATH)/avrdude.conf -endif - -ARDUINO_LIB_PATH = $(ARDUINO_DIR)/libraries -ARDUINO_CORE_PATH = $(ARDUINO_DIR)/hardware/arduino/cores/arduino - -endif - -######################################################################## -# boards.txt parsing -# -ifndef BOARD_TAG -BOARD_TAG = uno -endif - -ifndef BOARDS_TXT -BOARDS_TXT = $(ARDUINO_DIR)/hardware/arduino/boards.txt -endif - -ifndef PARSE_BOARD -PARSE_BOARD = ard-parse-boards --boards_txt=$(BOARDS_TXT) -endif - -# processor stuff -ifndef MCU -MCU = $(shell $(PARSE_BOARD) $(BOARD_TAG) build.mcu) -endif - -ifndef F_CPU -F_CPU = $(shell $(PARSE_BOARD) $(BOARD_TAG) build.f_cpu) -endif - -# normal programming info -ifndef AVRDUDE_ARD_PROGRAMMER -AVRDUDE_ARD_PROGRAMMER = $(shell $(PARSE_BOARD) $(BOARD_TAG) upload.protocol) -endif - -ifndef AVRDUDE_ARD_BAUDRATE -AVRDUDE_ARD_BAUDRATE = $(shell $(PARSE_BOARD) $(BOARD_TAG) upload.speed) -endif - -# fuses if you're using e.g. ISP -ifndef ISP_LOCK_FUSE_PRE -ISP_LOCK_FUSE_PRE = $(shell $(PARSE_BOARD) $(BOARD_TAG) bootloader.unlock_bits) -endif - -ifndef ISP_LOCK_FUSE_POST -ISP_LOCK_FUSE_POST = $(shell $(PARSE_BOARD) $(BOARD_TAG) bootloader.lock_bits) -endif - -ifndef ISP_HIGH_FUSE -ISP_HIGH_FUSE = $(shell $(PARSE_BOARD) $(BOARD_TAG) bootloader.high_fuses) -endif - -ifndef ISP_LOW_FUSE -ISP_LOW_FUSE = $(shell $(PARSE_BOARD) $(BOARD_TAG) bootloader.low_fuses) -endif - -ifndef ISP_EXT_FUSE -ISP_EXT_FUSE = $(shell $(PARSE_BOARD) $(BOARD_TAG) bootloader.extended_fuses) -endif - - - - -# Everything gets built in here -OBJDIR = build-cli - -######################################################################## -# Local sources -# -LOCAL_C_SRCS += $(wildcard *.c) -LOCAL_CPP_SRCS += $(wildcard *.cpp) -LOCAL_CC_SRCS = $(wildcard *.cc) -LOCAL_PDE_SRCS = $(wildcard *.pde) -LOCAL_AS_SRCS = $(wildcard *.S) -LOCAL_OBJ_FILES = $(LOCAL_C_SRCS:.c=.o) $(LOCAL_CPP_SRCS:.cpp=.o) \ - $(LOCAL_CC_SRCS:.cc=.o) $(LOCAL_PDE_SRCS:.pde=.o) \ - $(LOCAL_AS_SRCS:.S=.o) -LOCAL_OBJS = $(patsubst %,$(OBJDIR)/%,$(LOCAL_OBJ_FILES)) - -# Dependency files -DEPS = $(LOCAL_OBJS:.o=.d) - -# core sources -ifeq ($(strip $(NO_CORE)),) -ifdef ARDUINO_CORE_PATH -CORE_C_SRCS = $(wildcard $(ARDUINO_CORE_PATH)/*.c) -CORE_CPP_SRCS = $(wildcard $(ARDUINO_CORE_PATH)/*.cpp) -CORE_OBJ_FILES = $(CORE_C_SRCS:.c=.o) $(CORE_CPP_SRCS:.cpp=.o) -CORE_OBJS = $(patsubst $(ARDUINO_CORE_PATH)/%, \ - $(OBJDIR)/%,$(CORE_OBJ_FILES)) -endif -endif - -# all the objects! -OBJS = $(LOCAL_OBJS) $(CORE_OBJS) $(LIB_OBJS) - -######################################################################## -# Rules for making stuff -# - -# The name of the main targets -TARGET_HEX = $(OBJDIR)/$(TARGET).hex -TARGET_ELF = $(OBJDIR)/$(TARGET).elf -TARGETS = $(OBJDIR)/$(TARGET).* - -# A list of dependencies -DEP_FILE = $(OBJDIR)/depends.mk - -# Names of executables -CC = $(AVR_TOOLS_PATH)/avr-gcc -CXX = $(AVR_TOOLS_PATH)/avr-g++ -OBJCOPY = $(AVR_TOOLS_PATH)/avr-objcopy -OBJDUMP = $(AVR_TOOLS_PATH)/avr-objdump -AR = $(AVR_TOOLS_PATH)/avr-ar -SIZE = $(AVR_TOOLS_PATH)/avr-size -NM = $(AVR_TOOLS_PATH)/avr-nm -REMOVE = rm -f -MV = mv -f -CAT = cat -ECHO = echo - -# General arguments -SYS_LIBS = $(patsubst %,$(ARDUINO_LIB_PATH)/%,$(ARDUINO_LIBS)) -SYS_INCLUDES = $(patsubst %,-I%,$(SYS_LIBS)) -SYS_OBJS = $(wildcard $(patsubst %,%/*.o,$(SYS_LIBS))) -LIB_SRC = $(wildcard $(patsubst %,%/*.cpp,$(SYS_LIBS))) -LIB_OBJS = $(patsubst $(ARDUINO_LIB_PATH)/%.cpp,$(OBJDIR)/libs/%.o,$(LIB_SRC)) - -CPPFLAGS += -mmcu=$(MCU) -DF_CPU=$(F_CPU) \ - -I. -I$(ARDUINO_CORE_PATH) \ - $(SYS_INCLUDES) -g -Os -w -Wall \ - -ffunction-sections -fdata-sections -CFLAGS = -std=gnu99 -CXXFLAGS = -fno-exceptions -ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp -LDFLAGS = -mmcu=$(MCU) -lm -Wl,--gc-sections -Os - -# Rules for making a CPP file from the main sketch (.cpe) -PDEHEADER = \\\#include \"WProgram.h\" - -# Expand and pick the first port -ARD_PORT = $(firstword $(wildcard $(ARDUINO_PORT))) - -# Implicit rules for building everything (needed to get everything in -# the right directory) -# -# Rather than mess around with VPATH there are quasi-duplicate rules -# here for building e.g. a system C++ file and a local C++ -# file. Besides making things simpler now, this would also make it -# easy to change the build options in future - -# library sources -$(OBJDIR)/libs/%.o: $(ARDUINO_LIB_PATH)/%.cpp - mkdir -p $(dir $@) - $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@ - -# normal local sources -# .o rules are for objects, .d for dependency tracking -# there seems to be an awful lot of duplication here!!! -$(OBJDIR)/%.o: %.c - $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@ - -$(OBJDIR)/%.o: %.cc - $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@ - -$(OBJDIR)/%.o: %.cpp - $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@ - -$(OBJDIR)/%.o: %.S - $(CC) -c $(CPPFLAGS) $(ASFLAGS) $< -o $@ - -$(OBJDIR)/%.o: %.s - $(CC) -c $(CPPFLAGS) $(ASFLAGS) $< -o $@ - -$(OBJDIR)/%.d: %.c - $(CC) -MM $(CPPFLAGS) $(CFLAGS) $< -MF $@ -MT $(@:.d=.o) - -$(OBJDIR)/%.d: %.cc - $(CXX) -MM $(CPPFLAGS) $(CXXFLAGS) $< -MF $@ -MT $(@:.d=.o) - -$(OBJDIR)/%.d: %.cpp - $(CXX) -MM $(CPPFLAGS) $(CXXFLAGS) $< -MF $@ -MT $(@:.d=.o) - -$(OBJDIR)/%.d: %.S - $(CC) -MM $(CPPFLAGS) $(ASFLAGS) $< -MF $@ -MT $(@:.d=.o) - -$(OBJDIR)/%.d: %.s - $(CC) -MM $(CPPFLAGS) $(ASFLAGS) $< -MF $@ -MT $(@:.d=.o) - -# the pde -> cpp -> o file -$(OBJDIR)/%.cpp: %.pde - $(ECHO) $(PDEHEADER) > $@ - $(CAT) $< >> $@ - -$(OBJDIR)/%.o: $(OBJDIR)/%.cpp - $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@ - -$(OBJDIR)/%.d: $(OBJDIR)/%.cpp - $(CXX) -MM $(CPPFLAGS) $(CXXFLAGS) $< -MF $@ -MT $(@:.d=.o) - -# core files -$(OBJDIR)/%.o: $(ARDUINO_CORE_PATH)/%.c - $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@ - -$(OBJDIR)/%.o: $(ARDUINO_CORE_PATH)/%.cpp - $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@ - -# various object conversions -$(OBJDIR)/%.hex: $(OBJDIR)/%.elf - $(OBJCOPY) -O ihex -R .eeprom $< $@ - -$(OBJDIR)/%.eep: $(OBJDIR)/%.elf - -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ - --change-section-lma .eeprom=0 -O ihex $< $@ - -$(OBJDIR)/%.lss: $(OBJDIR)/%.elf - $(OBJDUMP) -h -S $< > $@ - -$(OBJDIR)/%.sym: $(OBJDIR)/%.elf - $(NM) -n $< > $@ - -######################################################################## -# -# Avrdude -# -ifndef AVRDUDE -AVRDUDE = $(AVR_TOOLS_PATH)/avrdude -endif - -AVRDUDE_COM_OPTS = -q -V -p $(MCU) -ifdef AVRDUDE_CONF -AVRDUDE_COM_OPTS += -C $(AVRDUDE_CONF) -endif - -AVRDUDE_ARD_OPTS = -c $(AVRDUDE_ARD_PROGRAMMER) -b $(AVRDUDE_ARD_BAUDRATE) -P $(ARD_PORT) - -ifndef ISP_PROG -ISP_PROG = -c stk500v2 -endif - -AVRDUDE_ISP_OPTS = -P $(ISP_PORT) $(ISP_PROG) - - -######################################################################## -# -# Explicit targets start here -# - -all: $(OBJDIR) $(TARGET_HEX) - -$(OBJDIR): - mkdir $(OBJDIR) - -$(TARGET_ELF): $(OBJS) - $(CC) $(LDFLAGS) -o $@ $(OBJS) $(SYS_OBJS) -lc - -$(DEP_FILE): $(OBJDIR) $(DEPS) - cat $(DEPS) > $(DEP_FILE) - -upload: reset raw_upload - -raw_upload: $(TARGET_HEX) - $(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ARD_OPTS) \ - -U flash:w:$(TARGET_HEX):i - -# stty on MacOS likes -F, but on Debian it likes -f redirecting -# stdin/out appears to work but generates a spurious error on MacOS at -# least. Perhaps it would be better to just do it in perl ? -reset: - for STTYF in 'stty --file' 'stty -f' 'stty <' ; \ - do $$STTYF /dev/tty >/dev/null 2>/dev/null && break ; \ - done ;\ - $$STTYF $(ARD_PORT) hupcl ;\ - (sleep 0.1 || sleep 1) ;\ - $$STTYF $(ARD_PORT) -hupcl - -ispload: $(TARGET_HEX) - $(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ISP_OPTS) -e \ - -U lock:w:$(ISP_LOCK_FUSE_PRE):m \ - -U hfuse:w:$(ISP_HIGH_FUSE):m \ - -U lfuse:w:$(ISP_LOW_FUSE):m \ - -U efuse:w:$(ISP_EXT_FUSE):m - $(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ISP_OPTS) -D \ - -U flash:w:$(TARGET_HEX):i - $(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ISP_OPTS) \ - -U lock:w:$(ISP_LOCK_FUSE_POST):m - -clean: - $(REMOVE) $(OBJS) $(TARGETS) $(DEP_FILE) $(DEPS) - -depends: $(DEPS) - cat $(DEPS) > $(DEP_FILE) - -show_boards: - $(PARSE_BOARD) --boards - -.PHONY: all clean depends upload raw_upload reset show_boards - -include $(DEP_FILE) diff --git a/ArduinoMakefile b/ArduinoMakefile deleted file mode 100644 index 407ada1..0000000 --- a/ArduinoMakefile +++ /dev/null @@ -1,22 +0,0 @@ -ARDUINO_DIR = /Applications/Arduino.app/Contents/Resources/Java - -TARGET = CSlim -BOARD_TAG = mega2560 -ARDUINO_PORT = /dev/tty.usbmodem621 -ARDUINO_LIBS = Ethernet Spi Ethernet/utility - -CSLIM_SRC = src/CSlim/Slim.c src/CSlim/ListExecutor.c src/CSlim/SlimConnectionHandler.c src/CSlim/SlimList.c \ -src/CSlim/SlimListDeserializer.c src/CSlim/SlimListSerializer.c src/CSlim/SlimUtil.c src/CSlim/StatementExecutor.c \ -src/CSlim/SymbolTable.c - -FIXTURE_C_SRC = fixtures/Fixtures.c fixtures/DecisionTableExample.c fixtures/ExceptionsExample.c fixtures/QueryTableExample.c \ -fixtures/ScriptTableExample.c -FIXTURE_CPP_SRC = fixtures/FixtureInCpp.cpp - -CPP_COMPILING = 1 -CPPFLAGS += -Iinclude/CSlim -Iinclude/ComArduino -LOCAL_C_SRCS += $(CSLIM_SRC) $(FIXTURE_C_SRC) -LOCAL_CPP_SRCS += src/ComArduino/SerialComLink.cpp src/ComArduino/TcpComLink.cpp $(FIXTURE_CPP_SRC) - -include Arduino.mk - diff --git a/COPYING.txt b/COPYING.txt new file mode 100644 index 0000000..9413a7d --- /dev/null +++ b/COPYING.txt @@ -0,0 +1,16 @@ +Fitnesse Slim plugin port for VC++ 2010 + +Copyright (C) 2012 Chih C. Von + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . diff --git a/CSlim_VS2010.sln b/CSlim_VS2010.sln new file mode 100644 index 0000000..f088df2 --- /dev/null +++ b/CSlim_VS2010.sln @@ -0,0 +1,37 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CSlim", "cslim\CSlim.vcxproj", "{5BE24E31-6003-4EAE-876A-96495093B3AC}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SlimExecutable", "SlimExecutable\SlimExecutable.vcxproj", "{C36263AA-26B2-45F5-9872-0C82717879F0}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CSlimTests", "UnitTest\CSlimTests\CSlimTests.vcxproj", "{0972A94C-B97C-45AE-AFB3-E356FDB52732}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{43E6AD52-457E-438A-88FA-64764E10215A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5BE24E31-6003-4EAE-876A-96495093B3AC}.Debug|Win32.ActiveCfg = Debug|Win32 + {5BE24E31-6003-4EAE-876A-96495093B3AC}.Debug|Win32.Build.0 = Debug|Win32 + {5BE24E31-6003-4EAE-876A-96495093B3AC}.Release|Win32.ActiveCfg = Release|Win32 + {5BE24E31-6003-4EAE-876A-96495093B3AC}.Release|Win32.Build.0 = Release|Win32 + {C36263AA-26B2-45F5-9872-0C82717879F0}.Debug|Win32.ActiveCfg = Debug|Win32 + {C36263AA-26B2-45F5-9872-0C82717879F0}.Debug|Win32.Build.0 = Debug|Win32 + {C36263AA-26B2-45F5-9872-0C82717879F0}.Release|Win32.ActiveCfg = Release|Win32 + {C36263AA-26B2-45F5-9872-0C82717879F0}.Release|Win32.Build.0 = Release|Win32 + {0972A94C-B97C-45AE-AFB3-E356FDB52732}.Debug|Win32.ActiveCfg = Debug|Win32 + {0972A94C-B97C-45AE-AFB3-E356FDB52732}.Debug|Win32.Build.0 = Debug|Win32 + {0972A94C-B97C-45AE-AFB3-E356FDB52732}.Release|Win32.ActiveCfg = Release|Win32 + {0972A94C-B97C-45AE-AFB3-E356FDB52732}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {0972A94C-B97C-45AE-AFB3-E356FDB52732} = {43E6AD52-457E-438A-88FA-64764E10215A} + EndGlobalSection +EndGlobal diff --git a/CSlim_VS2010.vcxproj b/CSlim_VS2010.vcxproj new file mode 100644 index 0000000..63893b1 --- /dev/null +++ b/CSlim_VS2010.vcxproj @@ -0,0 +1,67 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {96611F7B-003B-45AA-83B8-671650709823} + CSlim_VS2010 + + + + Application + true + MultiByte + + + Application + false + true + MultiByte + + + + + + + + + + + + + + + Level3 + Disabled + + + true + + + + + Level3 + MaxSpeed + true + true + + + true + true + true + + + + + + + + \ No newline at end of file diff --git a/CSlim_VS2010.vcxproj.filters b/CSlim_VS2010.vcxproj.filters new file mode 100644 index 0000000..d7ef6a1 --- /dev/null +++ b/CSlim_VS2010.vcxproj.filters @@ -0,0 +1,17 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + \ No newline at end of file diff --git a/Makefile b/Makefile deleted file mode 100644 index 7aa323b..0000000 --- a/Makefile +++ /dev/null @@ -1,82 +0,0 @@ -#Set this to @ to keep the makefile quiet -SILENCE = @ -RANLIB = ranlib -#---- Outputs ----# -COMPONENT_NAME = CSlim -TARGET_LIB = \ - lib/lib$(COMPONENT_NAME).a - -TEST_TARGET = \ - $(COMPONENT_NAME)_tests - -#--- Inputs ----# -PROJECT_HOME_DIR = . -ifeq "$(CPPUTEST_HOME)" "" - CPPUTEST_HOME = ../CppUTest -endif -ifeq "$(CSLIM_HOME)" "" - CSLIM_HOME = ../cslim -endif -CPP_PLATFORM = Gcc - -# set OS_PLATFROM to win to build with winsock -# OS_PLATFORM = win - -#CFLAGS are set to override malloc and free to get memory leak detection in C programs -CPPUTEST_CFLAGS = -Dmalloc=cpputest_malloc -Dfree=cpputest_free -CPPFLAGS = -Wall -#GCOVFLAGS = -fprofile-arcs -ftest-coverage - -#SRC_DIRS is a list of source directories that make up the target library -#If test files are in these directories, their IMPORT_TEST_GROUPs need -#to be included in main to force them to be linked in. By convention -#put them into an AllTests.h file in each directory -SRC_DIRS = \ - src/CSlim\ - src/ExecutorC\ - -ifeq ($(OS_PLATFORM), win) - SRC_DIRS += src/ComWin32 -else - SRC_DIRS += src/Com -endif - -#TEST_SRC_DIRS is a list of directories including -# - A test main (AllTests.cpp by convention) -# - OBJ files in these directories are included in the TEST_TARGET -# - Consequently - AllTests.h containing the IMPORT_TEST_GROUPS is not needed -# - -TEST_SRC_DIRS = \ - tests \ - tests/Com \ - tests/CSlim \ - -MOCKS_SRC_DIRS = \ - -CSLIM_SRC_DIRS = \ - fixtures - -#includes for all compiles -INCLUDES =\ - -Iinclude/Com\ - -Iinclude/CSlim\ - -Iinclude/ExecutorC\ - -Itests/CSlim\ - -I$(CPPUTEST_HOME)/include/\ - -#Flags to pass to ld - -ifeq ($(OS_PLATFORM), win) - LDFLAGS += -lWS2_32 -else - LDFLAGS += -endif - -LD_LIBRARIES += -lstdc++ - - -OTHER_MAKEFILE_TO_INCLUDE = $(CSLIM_HOME)/build/CSlimServerMakefile - -include $(CPPUTEST_HOME)/build/ComponentMakefile - -all: $(TEST_TARGET) $(CSLIM_TARGET) diff --git a/NMakefile b/NMakefile deleted file mode 100644 index 6bf7746..0000000 --- a/NMakefile +++ /dev/null @@ -1,45 +0,0 @@ -BASE_DIR=$(MAKEDIR) - -CFLAGS= /MT /EHsc /Zi /I$(BASE_DIR)\include\CSlim /I$(BASE_DIR)\include\Com \ - /I$(BASE_DIR)\include\VS2010 -Dsnprintf=_snprintf /FIstring.h /TP /c \ - -DCPP_COMPILING=1 - -FIXTURES_SRC=$(BASE_DIR)\fixtures - -SLIM_LIB=$(BASE_DIR)\Lib\CSlim.lib -SLIM_EXE=$(FIXTURES_SRC)\slim.exe - -CSLIM_SRC=$(BASE_DIR)\src\CSlim -ComWin32_SRC=$(BASE_DIR)\src\ComWin32 - -LFLAGS=/DEBUG /SUBSYSTEM:CONSOLE /OUT:$(SLIM_EXE) -LOBJS=$(SLIM_LIB) $(ComWin32_SRC)\*.obj $(FIXTURES_SRC)\*.obj - -WS2_32="C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib\WS2_32.Lib" - -all: TheFixtures CSlim ComWin32 CSlim_lib SlimExecutable - -CSlim: - cd $(CSLIM_SRC) - cl $(CFLAGS) *.c - cd $(BASE_DIR) - -ComWin32: - cd $(ComWin32_SRC) - cl $(CFLAGS) *.c - cd $(BASE_DIR) - -CSlim_lib: - cd $(BASE_DIR) - lib /out:$(SLIM_LIB) src\CSlim\*.obj src\ComWin32\*.obj - -TheFixtures: - cd $(FIXTURES_SRC) - cl $(CFLAGS) *.c *.cpp - -SlimExecutable: - cd $(BASE_DIR) - link $(LFLAGS) $(LOBJS) $(WS2_32) - -clean: - del $(LOBJS) $(SLIM_LIB) $(SLIM_EXE) diff --git a/PageExamples/CounterTest/content.txt b/PageExamples/CounterTest/content.txt new file mode 100644 index 0000000..3c55515 --- /dev/null +++ b/PageExamples/CounterTest/content.txt @@ -0,0 +1,4 @@ +!|script|Count| +|count| +|count| +|check|counter|2| diff --git a/fixtures/pages/CounterTest/properties.xml b/PageExamples/CounterTest/properties.xml similarity index 100% rename from fixtures/pages/CounterTest/properties.xml rename to PageExamples/CounterTest/properties.xml diff --git a/PageExamples/DivisionTest/content.txt b/PageExamples/DivisionTest/content.txt new file mode 100644 index 0000000..c8d463f --- /dev/null +++ b/PageExamples/DivisionTest/content.txt @@ -0,0 +1,7 @@ +!|Division| +|numerator|denominator|Quotient?| +|10|5|2| +|55|11|5| +|1|1|1| +|3|2|1.5| +|10|3|3.33333| diff --git a/fixtures/pages/DivisionTest/properties.xml b/PageExamples/DivisionTest/properties.xml similarity index 100% rename from fixtures/pages/DivisionTest/properties.xml rename to PageExamples/DivisionTest/properties.xml diff --git a/fixtures/pages/ExceptionsTest/content.txt b/PageExamples/ExceptionsTest/content.txt similarity index 100% rename from fixtures/pages/ExceptionsTest/content.txt rename to PageExamples/ExceptionsTest/content.txt diff --git a/fixtures/pages/ExceptionsTest/properties.xml b/PageExamples/ExceptionsTest/properties.xml similarity index 100% rename from fixtures/pages/ExceptionsTest/properties.xml rename to PageExamples/ExceptionsTest/properties.xml diff --git a/fixtures/pages/FirstCslimTest/content.txt b/PageExamples/FirstCslimTest/content.txt similarity index 100% rename from fixtures/pages/FirstCslimTest/content.txt rename to PageExamples/FirstCslimTest/content.txt diff --git a/fixtures/pages/FirstCslimTest/properties.xml b/PageExamples/FirstCslimTest/properties.xml similarity index 100% rename from fixtures/pages/FirstCslimTest/properties.xml rename to PageExamples/FirstCslimTest/properties.xml diff --git a/fixtures/pages/MultiplicationTest/content.txt b/PageExamples/MultiplicationTest/content.txt similarity index 100% rename from fixtures/pages/MultiplicationTest/content.txt rename to PageExamples/MultiplicationTest/content.txt diff --git a/fixtures/pages/MultiplicationTest/properties.xml b/PageExamples/MultiplicationTest/properties.xml similarity index 100% rename from fixtures/pages/MultiplicationTest/properties.xml rename to PageExamples/MultiplicationTest/properties.xml diff --git a/fixtures/pages/PayRollTest/content.txt b/PageExamples/PayRollTest/content.txt similarity index 100% rename from fixtures/pages/PayRollTest/content.txt rename to PageExamples/PayRollTest/content.txt diff --git a/fixtures/pages/PayRollTest/properties.xml b/PageExamples/PayRollTest/properties.xml similarity index 100% rename from fixtures/pages/PayRollTest/properties.xml rename to PageExamples/PayRollTest/properties.xml diff --git a/PageExamples/content.txt b/PageExamples/content.txt new file mode 100644 index 0000000..c557f77 --- /dev/null +++ b/PageExamples/content.txt @@ -0,0 +1,7 @@ +!contents -R2 -g -p -f -h + +!define TEST_SYSTEM {slim} +!define TEST_RUNNER {c:\cslim_vs2010\release\slimexecutable.exe} +!define COMMAND_PATTERN {%m} + +!define SLIM_VERSION {0.0} \ No newline at end of file diff --git a/fixtures/pages/properties.xml b/PageExamples/properties.xml similarity index 100% rename from fixtures/pages/properties.xml rename to PageExamples/properties.xml diff --git a/README.txt b/README.txt index bb8cb2d..30e3f9b 100644 --- a/README.txt +++ b/README.txt @@ -1,55 +1,75 @@ -CSlim - An implementation of FitNesse SliM in C -Authors: Robert Martin, James Grenning, and Doug Bradbury +VCSlim - FitNesse SliM plugin port for VC++ 2010 +Author: Chih Von ************ * Fixtures * ************ -Fixtures in CSlim are sets of functions and a data structure that binds them together. See Main/DecisionTableExample.c +Fixtures in VCSlim are sets of objects that implement functions used in Fitnesse tests and fixtures should derive from Slim::FixtureBase in following fashion: +class Division : public Slim::FixtureBase +{ +public: + // REQUIRED by VCSlim machinery. + typedef Slim::FixtureBase tSuper; -Note that the struct Division is used to hold data for all the functions in this fixture, rather like an object . + // FixtureIntf overrides. + virtual ~Division(); + virtual void Destroy(); -Each function returns a char*, and you'd better control the memory for what it returns. You can return a pointer to a static variable, or to a dynamically allocated buffer. You can delete dynamically allocated buffers in your "destructor" (see below); Repeat, every function returns a char*, so if you want to return an integer you'll have to convert it to a char*. See the ScriptTableExample for a rather discouraging example of way that this needs to be done. +private: + // REQUIRED by VCSlim machinery. + friend tSuper; + static Slim::FixtureIntf* Create(Slim::StatementExecutor* executor, Slim::SlimList* args); -Slim calls your functions with a void* pointer to the fixture data structure. You'll have to cast the void* if you want to use it. The functions also take a pointer to a SlimList that contains all the arguments were passed to your function. These arguments will be strings or other SlimLists, and you'll have to just know which are which. You should get familiar with the SlimList interface. It's not very exciting, but you'll be using it a lot. Take a close look at the QueryTableExample. It makes considerable use of SlimList, and the related function SlimList_Serialize; + // Fixture methods + std::string setNumerator(Slim::SlimList* args); + . . . + + // Fixture states + . . . +}; +See SlimExecutable/Division.h for example. + + +Each fixture's registered function returns an std::string object by value which cleans up itself nicely when it goes out its scope. + +VCSlim calls your fixture's registered functions throgh FixtureIntf::Execute method. The functions also take a pointer to a SlimList that contains all the arguments were passed to your function. These arguments will be strings or other SlimLists, and you'll have to just know which are which. You should get familiar with the SlimList interface. It's not very exciting, but you'll be using it a lot. Take a close look at the SlimExecutable/Query.cpp. It makes considerable use of SlimList, and the related function SlimList::Serialize; + +You can cause a slim exception in any function by returning a message with the SLIM_EXCEPTION(reason) macro. This will turn the cell being executed yellow. To cause an exception in a Create function (if, for example the wrong number of arguments have been given to it), use the SLIM_CONSTRUCTOR_ERROR(errorHandler, reason) macro. See SlimExecutable/Exceptions.cpp for examples of create exceptions. -You can cause a slim exception in any function by returning a message with the SLIM_EXCEPTION(reason) macro. This will turn the cell being executed yellow. To cause an exception in a Create function (if, for example the wrong number of arguments have been given to it), use the SLIM_CONSTRUCTOR_ERROR(errorHandler, reason) macro. See Main/ExceptionExample.c for examples of create exceptions. **************** * Registration * **************** -Notice the CREATE_FIXTURE business at the bottom of the DecisionTableExample.c file. -CSLIM_CREATE_FIXTURE(Division) - CSLIM_FUNCTION(setNumerator) - CSLIM_FUNCTION(setDenominator) - CSLIM_FUNCTION(Quotient) -CSLIM_END +Notice the SLIM_BEGIN_FIXTURE business at the top of the SlimExecutable/Division.cpp file. +SLIM_BEGIN_FIXTURE(Division) + SLIM_FUNCTION(setNumerator) + SLIM_FUNCTION(setDenominator) + SLIM_FUNCTION(Quotient) +SLIM_END -This creates a registration function that will be called by the main program of the Slim Server. It is your responsibility to register your fixture and your functions with these Macros. +This creates a function lookup table that will be used when VCSlim calls your fixture object's Execute method. It is your responsibility to register your fixture and your functions with these Macros. -You register a fixture by calling CSLIM_CREATE_FIXTURE(FixtureName). You must define Create_FixtureName and Destroy_FixtureName in order for this macro to work. The create function is used to allocate and initialize the fixture data structure. The destroy function is your destructor. You use it to free any memory you may have allocated. If you don't like the naming convention, you can write the registration function yourself. Have a look at the macro definitions in Fixtures.h. +You register a fixture by calling SLIM_BEGIN_FIXTURE(FixtureName). The base class Slim::FixtureBase that your fixture derives from provides the factory method for this macro to work. You then must define a static Create function and a virtual Destroy function for VCSlim machinery to work. The create function is used to create a new fixture instance. The destroy function is your destructor, you use it to release any resource that the create function acquired. If you don't like the naming convention, you can write the registration function yourself. Have a look at the macro definitions in CSlim/Include/CSlim/Fixtures.h. -You register your functions with the CSLIM_FUNCTION macro with a pointer to the function. +You register the functions you want to expose to Fitnesse with the SLIM_FUNCTION macro and they match the names used by Fitnesse tests. -The names are used by FitNesse match the actual C names by convention, but you can skip the macro and make the call yourself if you'd like to use different names +Now look at the SlimExecutable/Fixturess.cpp file. This is where you tell the main Slim Server program about all your fixtures. The SLIM_FIXTURES and SLIM_FIXTURE macros make this easy. The fixture name you use in the FIXTURE macro in Fixtures.cpp must match the name you used in the SLIM_BEGIN_FIXTURE macro in your fixture file. -Now look at the Main/Fixtures.c file. This is where you tell the main Slim Server program about all your fixtures. The CSLIM_FIXTURES and CSLIM_FIXTURE macros make this easy. The fixture name you use in the FIXTURE macro in Fixtures.c must match the name you used in the CREATE_FIXTURE macro in your fixture file. -If you happen to have a fixture that does not have any functions, like for setup and tear down, you can use this macro: +******************** +* VS 2010 Solution * +******************** +The only thing left is the VS2010 solution file. The solution provided will build the CSlim library and its unit tests. It will also build an executable from everything in /SlimExecutable. -SLIM_CREATE_EMPTY_FIXTURE(name) +VCSlim depends on Boost library, you have to download Boost from www.boost.org and install it. Since the build will run unit tests automatically you will need boost::unit_test dll, not just headers. -************ -* Makefile * -************ -The only thing left is the makefile. The makefile provided will build the CSlim library and its unit tests. It will also build a second executable from everything in /fixtures. CSlim depends on CppUTest, notice it is using the ComponentMakefile from CppUTest. You can model your makefiles after these or whatever you want. +After installed Boost you need to change the Boost include path in "Additional Include Directories" for all projects in the solution, you also need to change the Boost::unit_test dll path in "AAdditional Library Directories" for project CSlimTests. -To build for windows, uncomment this line in the makefile -# OS_PLATFORM = win -************************************* -* Running the example fitnesse test * -************************************* -You need to download FitNesse from fitnesse.org. Example pages are in cslim/fixtures/pages. Fire up fitnesse and create a new page like CslimExample. Add this to your CslimExample page: +*************************************** +* Running the example acceptance test * +*************************************** +You need to download FitNesse from fitnesse.org. Example pages are in CSlim_VS2010/PageExamples. Fire up fitnesse and create a new page like CslimExample. Add this to your CslimExample page: !contents -R2 -g -p -f -h @@ -57,28 +77,11 @@ You need to download FitNesse from fitnesse.org. Example pages are in cslim/fix !define TEST_RUNNER {/cslim/Cslim_cslim} !define COMMAND_PATTERN {%m} -If you are using a unix based system, make a symbolic link in fitnesse/FitNesseRoot/CslimExample pointing to cslim/fixtures/pages, with a command like this: - - ln -s /cslim/fixtures/pages CslimExampleSuite - You should be able to see the CounterTest, DivisionTest, etc. -************** -* Unit Tests * -************** -CSlim was built using CppUTest. You'll have to down load and make CppUTest (http://www.cpputest.org/). Put it next to the cslim directory like this: - -/cslim -/CppUTest - - ****************** * Communications * ****************** -CSlim communicates with FitNesse over a stream socket. A bsd socket implementation of sockets is provided. You can use CSlim with other socket implementations by re-implementing the modules in src/Com +VCSlim communicates with FitNesse over a stream socket. A win32 socket implementation of sockets is provided. -******* -* C++ * -******* -When using CSlim to test a C++ project, give you fixtures .cpp extensions, but make sure to wrap all the fixture methods in an 'extern "C"' See Main/FixtureInCpp.cpp for an example of testing a C++ class with CSlim. diff --git a/SlimExecutable/Count.cpp b/SlimExecutable/Count.cpp new file mode 100644 index 0000000..f8e5321 --- /dev/null +++ b/SlimExecutable/Count.cpp @@ -0,0 +1,46 @@ +#include "Count.h" +#include "Fixtures.h" + +#include "SlimList.h" +#include "StatementExecutor.h" + +#include +#include + +SLIM_BEGIN_FIXTURE(Count) + SLIM_FUNCTION(count) + SLIM_FUNCTION(counter) +SLIM_END_FIXTURE + + +Slim::FixtureIntf* Count::Create(Slim::StatementExecutor* executor, Slim::SlimList* args) +{ + return new Count(); +} + +Count::Count() + : m_count(0) +{ + +} + +Count::~Count() +{ + +} + +void Count::Destroy() +{ + delete this; +} + +std::string Count::count(Slim::SlimList* args) +{ + ++m_count; + return std::string(); +} + +std::string Count::counter(Slim::SlimList* args) +{ + return (boost::format("%1%") % m_count).str(); +} diff --git a/SlimExecutable/Count.h b/SlimExecutable/Count.h new file mode 100644 index 0000000..641ca1f --- /dev/null +++ b/SlimExecutable/Count.h @@ -0,0 +1,25 @@ +#pragma once + +#include "Fixture.h" + +class Count : public Slim::FixtureBase +{ +public: + typedef Slim::FixtureBase tSuper; + + Count(); + ~Count(); + + virtual void Destroy(); + +private: + friend tSuper; + + static Slim::FixtureIntf* Create(Slim::StatementExecutor* executor, Slim::SlimList* args); + + // Fixture methods + std::string count(Slim::SlimList* args); + std::string counter(Slim::SlimList* args); + + size_t m_count; +}; diff --git a/SlimExecutable/Division.cpp b/SlimExecutable/Division.cpp new file mode 100644 index 0000000..4b05640 --- /dev/null +++ b/SlimExecutable/Division.cpp @@ -0,0 +1,69 @@ +#include "Division.h" +#include "Fixtures.h" + +#include "SlimList.h" +#include "StatementExecutor.h" + +#include +#include + +SLIM_BEGIN_FIXTURE(Division) + SLIM_FUNCTION(setNumerator) + SLIM_FUNCTION(setDenominator) + SLIM_FUNCTION(Quotient) + SLIM_FUNCTION(execute) + SLIM_FUNCTION(reset) + SLIM_FUNCTION(table) +SLIM_END_FIXTURE + + +Slim::FixtureIntf* Division::Create(Slim::StatementExecutor* executor, Slim::SlimList* args) +{ + return new Division(); +} + +Division::~Division() +{ + +} + +void Division::Destroy() +{ + delete this; +} + +std::string Division::setNumerator(Slim::SlimList* args) +{ + m_numerator = boost::lexical_cast(args->GetStringAt(0)); + return std::string(); +} + +std::string Division::setDenominator(Slim::SlimList* args) +{ + m_denominator = boost::lexical_cast(args->GetStringAt(0)); + return m_denominator == 0.0 ? SLIM_EXCEPTION("You shouldn't divide by zero now should ya?") : std::string(); +} + +std::string Division::Quotient(Slim::SlimList* args) +{ + float quotient = m_numerator / m_denominator; + return (boost::format("%1%") % quotient).str(); +} + +//These are optional. If they aren't declared, they are ignored +std::string Division::execute(Slim::SlimList* args) +{ + return std::string(); +} + +std::string Division::reset(Slim::SlimList* args) +{ + m_denominator = 0.0f; + m_numerator = 0.0f; + return std::string(); +} + +std::string Division::table(Slim::SlimList* args) +{ + return std::string(); +} diff --git a/SlimExecutable/Division.h b/SlimExecutable/Division.h new file mode 100644 index 0000000..d4ec7a3 --- /dev/null +++ b/SlimExecutable/Division.h @@ -0,0 +1,29 @@ +#pragma once + +#include "Fixture.h" + +class Division : public Slim::FixtureBase +{ +public: + typedef Slim::FixtureBase tSuper; + + ~Division(); + + virtual void Destroy(); + +private: + friend tSuper; + + static Slim::FixtureIntf* Create(Slim::StatementExecutor* executor, Slim::SlimList* args); + + // Fixture methods + std::string setNumerator(Slim::SlimList* args); + std::string setDenominator(Slim::SlimList* args); + std::string Quotient(Slim::SlimList* args); + std::string execute(Slim::SlimList* args); + std::string reset(Slim::SlimList* args); + std::string table(Slim::SlimList* args); + + float m_numerator; + float m_denominator; +}; diff --git a/SlimExecutable/Exceptions.cpp b/SlimExecutable/Exceptions.cpp new file mode 100644 index 0000000..188568d --- /dev/null +++ b/SlimExecutable/Exceptions.cpp @@ -0,0 +1,30 @@ +#include "Exceptions.h" +#include "Fixtures.h" + +#include "SlimList.h" +#include "StatementExecutor.h" + +SLIM_BEGIN_FIXTURE(ExceptionsExample) + SLIM_FUNCTION(setTrouble) +SLIM_END_FIXTURE + + +Slim::FixtureIntf* ExceptionsExample::Create(Slim::StatementExecutor* executor, Slim::SlimList* args) +{ + return new ExceptionsExample(); +} + +ExceptionsExample::~ExceptionsExample() +{ + +} + +void ExceptionsExample::Destroy() +{ + delete this; +} + +std::string ExceptionsExample::setTrouble(Slim::SlimList* args) +{ + return SLIM_EXCEPTION("You stink"); +} diff --git a/SlimExecutable/Exceptions.h b/SlimExecutable/Exceptions.h new file mode 100644 index 0000000..f5a7f6f --- /dev/null +++ b/SlimExecutable/Exceptions.h @@ -0,0 +1,21 @@ +#pragma once + +#include "Fixture.h" + +class ExceptionsExample : public Slim::FixtureBase +{ +public: + typedef Slim::FixtureBase tSuper; + + ~ExceptionsExample(); + + virtual void Destroy(); + +private: + friend tSuper; + + static Slim::FixtureIntf* Create(Slim::StatementExecutor* executor, Slim::SlimList* args); + + // Fixture methods + std::string setTrouble(Slim::SlimList* args); +}; diff --git a/fixtures/Fixtures.c b/SlimExecutable/Fixtures.cpp similarity index 57% rename from fixtures/Fixtures.c rename to SlimExecutable/Fixtures.cpp index ebaf6b3..eda9e1f 100644 --- a/fixtures/Fixtures.c +++ b/SlimExecutable/Fixtures.cpp @@ -1,10 +1,11 @@ #include "Fixtures.h" +#include "StatementExecutor.h" SLIM_FIXTURES SLIM_FIXTURE(Division) SLIM_FIXTURE(Count) SLIM_FIXTURE(EmployeePayRecordsRow) - SLIM_FIXTURE(ExceptionsExample) - SLIM_FIXTURE(Multiplication) + SLIM_FIXTURE(Multiplication) + SLIM_FIXTURE(ExceptionsExample) SLIM_END diff --git a/SlimExecutable/Main.cpp b/SlimExecutable/Main.cpp new file mode 100644 index 0000000..ef82573 --- /dev/null +++ b/SlimExecutable/Main.cpp @@ -0,0 +1,11 @@ +#include + +int main(int ac, char** av) +{ + return RunFixtures(av[1]); +} + + + + + diff --git a/SlimExecutable/Multiplication.cpp b/SlimExecutable/Multiplication.cpp new file mode 100644 index 0000000..2902200 --- /dev/null +++ b/SlimExecutable/Multiplication.cpp @@ -0,0 +1,47 @@ +#include "Multiplication.h" +#include "Fixtures.h" + +#include "SlimList.h" +#include "StatementExecutor.h" + +#include +#include + +SLIM_BEGIN_FIXTURE(Multiplication) + SLIM_FUNCTION(setMultiplicand1) + SLIM_FUNCTION(setMultiplicand2) + SLIM_FUNCTION(Product) +SLIM_END_FIXTURE + + +Slim::FixtureIntf* Multiplication::Create(Slim::StatementExecutor* executor, Slim::SlimList* args) +{ + return new Multiplication(); +} + +Multiplication::~Multiplication() +{ + +} + +void Multiplication::Destroy() +{ + delete this; +} + +std::string Multiplication::setMultiplicand1(Slim::SlimList* args) +{ + m_m1 = boost::lexical_cast(args->GetStringAt(0)); + return std::string(); +} + +std::string Multiplication::setMultiplicand2(Slim::SlimList* args) +{ + m_m2 = boost::lexical_cast(args->GetStringAt(0)); + return std::string(); +} + +std::string Multiplication::Product(Slim::SlimList* args) +{ + return (boost::format("%1%") % (m_m1 * m_m2)).str(); +} diff --git a/SlimExecutable/Multiplication.h b/SlimExecutable/Multiplication.h new file mode 100644 index 0000000..8bd2da8 --- /dev/null +++ b/SlimExecutable/Multiplication.h @@ -0,0 +1,26 @@ +#pragma once + +#include "Fixture.h" + +class Multiplication : public Slim::FixtureBase +{ +public: + typedef Slim::FixtureBase tSuper; + + ~Multiplication(); + + virtual void Destroy(); + +private: + friend tSuper; + + static Slim::FixtureIntf* Create(Slim::StatementExecutor* executor, Slim::SlimList* args); + + // Fixture methods + std::string setMultiplicand1(Slim::SlimList* args); + std::string setMultiplicand2(Slim::SlimList* args); + std::string Product(Slim::SlimList* args); + + float m_m1; + float m_m2; +}; diff --git a/SlimExecutable/Query.cpp b/SlimExecutable/Query.cpp new file mode 100644 index 0000000..51f27fd --- /dev/null +++ b/SlimExecutable/Query.cpp @@ -0,0 +1,52 @@ +#include "Query.h" +#include "Fixtures.h" + +#include "SlimList.h" +#include "StatementExecutor.h" + +SLIM_BEGIN_FIXTURE(EmployeePayRecordsRow) + SLIM_FUNCTION(query) +SLIM_END_FIXTURE + + +Slim::FixtureIntf* EmployeePayRecordsRow::Create(Slim::StatementExecutor* executor, Slim::SlimList* args) +{ + return new EmployeePayRecordsRow(); +} + +EmployeePayRecordsRow::~EmployeePayRecordsRow() +{ + +} + +void EmployeePayRecordsRow::Destroy() +{ + delete this; +} + +std::string EmployeePayRecordsRow::query(Slim::SlimList* args) +{ + Slim::SlimList* id = new Slim::SlimList(); + id->AddString("id"); + id->AddString("1"); + + Slim::SlimList* pay = new Slim::SlimList(); + pay->AddString("pay"); + pay->AddString("1000"); + + Slim::SlimList* record1 = new Slim::SlimList(); + record1->AddList(id); + record1->AddList(pay); + + Slim::SlimList* records = new Slim::SlimList(); + records->AddList(record1); + + std::string result = Slim::SlimList::Serialize(records); + + delete id; + delete pay; + delete record1; + delete records; + + return result; +} diff --git a/SlimExecutable/Query.h b/SlimExecutable/Query.h new file mode 100644 index 0000000..148f92e --- /dev/null +++ b/SlimExecutable/Query.h @@ -0,0 +1,21 @@ +#pragma once + +#include "Fixture.h" + +class EmployeePayRecordsRow : public Slim::FixtureBase +{ +public: + typedef Slim::FixtureBase tSuper; + + ~EmployeePayRecordsRow(); + + virtual void Destroy(); + +private: + friend tSuper; + + static Slim::FixtureIntf* Create(Slim::StatementExecutor* executor, Slim::SlimList* args); + + // Fixture methods + std::string query(Slim::SlimList* args); +}; diff --git a/lib/.emptydir b/SlimExecutable/Script.h similarity index 100% rename from lib/.emptydir rename to SlimExecutable/Script.h diff --git a/SlimExecutable/SlimExecutable.sln b/SlimExecutable/SlimExecutable.sln new file mode 100644 index 0000000..1e60b17 --- /dev/null +++ b/SlimExecutable/SlimExecutable.sln @@ -0,0 +1,45 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SlimExecutable", "SlimExecutable.vcxproj", "{C36263AA-26B2-45F5-9872-0C82717879F0}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CSlim", "..\cslim\CSlim.vcxproj", "{5BE24E31-6003-4EAE-876A-96495093B3AC}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{A166FC0E-0602-4FF5-BE83-71D6656C553F}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CSlimTests", "..\UnitTest\CSlimTests\CSlimTests.vcxproj", "{0972A94C-B97C-45AE-AFB3-E356FDB52732}" +EndProject +Global + GlobalSection(SourceCodeControl) = preSolution + SccNumberOfProjects = 3 + SccLocalPath0 = . + SccProjectUniqueName1 = SlimExecutable.vcxproj + SccLocalPath1 = . + SccProjectUniqueName2 = ..\\cslim\\CSlim.vcxproj + SccLocalPath2 = ..\\cslim + EndGlobalSection + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C36263AA-26B2-45F5-9872-0C82717879F0}.Debug|Win32.ActiveCfg = Debug|Win32 + {C36263AA-26B2-45F5-9872-0C82717879F0}.Debug|Win32.Build.0 = Debug|Win32 + {C36263AA-26B2-45F5-9872-0C82717879F0}.Release|Win32.ActiveCfg = Release|Win32 + {C36263AA-26B2-45F5-9872-0C82717879F0}.Release|Win32.Build.0 = Release|Win32 + {5BE24E31-6003-4EAE-876A-96495093B3AC}.Debug|Win32.ActiveCfg = Debug|Win32 + {5BE24E31-6003-4EAE-876A-96495093B3AC}.Debug|Win32.Build.0 = Debug|Win32 + {5BE24E31-6003-4EAE-876A-96495093B3AC}.Release|Win32.ActiveCfg = Release|Win32 + {5BE24E31-6003-4EAE-876A-96495093B3AC}.Release|Win32.Build.0 = Release|Win32 + {0972A94C-B97C-45AE-AFB3-E356FDB52732}.Debug|Win32.ActiveCfg = Debug|Win32 + {0972A94C-B97C-45AE-AFB3-E356FDB52732}.Debug|Win32.Build.0 = Debug|Win32 + {0972A94C-B97C-45AE-AFB3-E356FDB52732}.Release|Win32.ActiveCfg = Release|Win32 + {0972A94C-B97C-45AE-AFB3-E356FDB52732}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {0972A94C-B97C-45AE-AFB3-E356FDB52732} = {A166FC0E-0602-4FF5-BE83-71D6656C553F} + EndGlobalSection +EndGlobal diff --git a/SlimExecutable/SlimExecutable.vcxproj b/SlimExecutable/SlimExecutable.vcxproj new file mode 100644 index 0000000..38c28fb --- /dev/null +++ b/SlimExecutable/SlimExecutable.vcxproj @@ -0,0 +1,103 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {C36263AA-26B2-45F5-9872-0C82717879F0} + SlimExecutable + + + + + + + + + + + + Application + true + Unicode + + + Application + false + true + Unicode + + + + + + + + + + + + + + + Level3 + Disabled + $(SolutionDir)\cslim\include\com;$(SolutionDir)\cslim\include\cslim;$(SolutionDir)\cslim\include\vs2010;C:\Program Files %28x86%29\boost\boost_1_47;%(AdditionalIncludeDirectories) + CPP_COMPILING;snprintf=_snprintf;%(PreprocessorDefinitions) + + + true + + + ws2_32.lib;%(AdditionalDependencies) + + + + + Level3 + MaxSpeed + true + true + $(SolutionDir)\cslim\include\com;$(SolutionDir)\cslim\include\cslim;$(SolutionDir)\cslim\include\vs2010;C:\Program Files %28x86%29\boost\boost_1_47;%(AdditionalIncludeDirectories) + CPP_COMPILING;snprintf=_snprintf;%(PreprocessorDefinitions) + + + true + true + true + ws2_32.lib + ws2_32.lib;%(AdditionalDependencies) + + + + + + + + + + + + + + + + + + + + + {5be24e31-6003-4eae-876a-96495093b3ac} + + + + + + \ No newline at end of file diff --git a/SlimExecutable/SlimExecutable.vcxproj.filters b/SlimExecutable/SlimExecutable.vcxproj.filters new file mode 100644 index 0000000..160ccac --- /dev/null +++ b/SlimExecutable/SlimExecutable.vcxproj.filters @@ -0,0 +1,57 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/UnitTest/CSlimTests/CSlimTests.cpp b/UnitTest/CSlimTests/CSlimTests.cpp new file mode 100644 index 0000000..3c7fec9 --- /dev/null +++ b/UnitTest/CSlimTests/CSlimTests.cpp @@ -0,0 +1,11 @@ +// CSlimTests.cpp : Defines the entry point for the console application. +// + +#include "stdafx.h" + + +int _tmain(int argc, _TCHAR* argv[]) +{ + return 0; +} + diff --git a/UnitTest/CSlimTests/CSlimTests.vcxproj b/UnitTest/CSlimTests/CSlimTests.vcxproj new file mode 100644 index 0000000..919c1ed --- /dev/null +++ b/UnitTest/CSlimTests/CSlimTests.vcxproj @@ -0,0 +1,125 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {0972A94C-B97C-45AE-AFB3-E356FDB52732} + Win32Proj + CSlimTests + + + + + + + + + + + + Application + true + Unicode + + + Application + false + true + Unicode + + + + + + + + + + + + + true + + + false + + + + Use + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + $(SolutionDir)\cslim\include\com;$(SolutionDir)\cslim\include\cslim;$(SolutionDir)\cslim\include\vs2010;C:\Program Files %28x86%29\boost\boost_1_47;%(AdditionalIncludeDirectories) + + + Console + true + C:\Program Files %28x86%29\boost\boost_1_47\lib;%(AdditionalLibraryDirectories) + + + del $(OutDir)results.txt + + + Path=C:\Program Files (x86)\boost\boost_1_47\lib +$(OutDir)$(TargetName)$(TargetExt) && echo>$(OutDir)results.txt + $(OutDir)results.txt;%(Outputs) + Execute unit tests ... + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + $(SolutionDir)\cslim\include\com;$(SolutionDir)\cslim\include\cslim;$(SolutionDir)\cslim\include\vs2010;C:\Program Files %28x86%29\boost\boost_1_47;%(AdditionalIncludeDirectories) + + + Console + true + true + true + C:\Program Files %28x86%29\boost\boost_1_47\lib;%(AdditionalLibraryDirectories) + + + + + + + + + + + + + + + + + Create + Create + + + + + + + + + {5be24e31-6003-4eae-876a-96495093b3ac} + + + + + + \ No newline at end of file diff --git a/UnitTest/CSlimTests/CSlimTests.vcxproj.filters b/UnitTest/CSlimTests/CSlimTests.vcxproj.filters new file mode 100644 index 0000000..e6ade7b --- /dev/null +++ b/UnitTest/CSlimTests/CSlimTests.vcxproj.filters @@ -0,0 +1,66 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + \ No newline at end of file diff --git a/UnitTest/CSlimTests/ListExecutorTests.cpp b/UnitTest/CSlimTests/ListExecutorTests.cpp new file mode 100644 index 0000000..335cc4f --- /dev/null +++ b/UnitTest/CSlimTests/ListExecutorTests.cpp @@ -0,0 +1,260 @@ +#include "stdafx.h" + +#include +#include +#include + +using namespace Slim; + +BOOST_TEST_DONT_PRINT_LOG_VALUE(SlimList); + +extern void AddFixtures(StatementExecutor*); + +struct InitListExecutorTest +{ + InitListExecutorTest() + : listExecutor(&statementExecutor) + { + AddFixtures(&statementExecutor); + char const* import[] = {"i1", "import", "blah", 0}; + AddStatementTo(&instructions, import); + char const * make[] = {"m1", "make", "test_slim", "TestSlim", 0}; + AddStatementTo(&instructions, make); + } + + ~InitListExecutorTest() + { + } + + void AddStatementTo(SlimList* instructions, char const** elements) + { + SlimList* statement = new SlimList(); + while (*elements) + { + statement->AddString(*elements++); + } + instructions->AddList(statement); + delete statement; + } + + ListExecutor listExecutor; + SlimList instructions; + StatementExecutor statementExecutor; +}; + +BOOST_FIXTURE_TEST_SUITE(ListExecutorTestSuite, InitListExecutorTest) + + +BOOST_AUTO_TEST_CASE(ImportShouldReturnOk) +{ + SlimList* results = listExecutor.Execute(&instructions); + SlimList* importResult = results->GetListAt(0); + BOOST_CHECK_EQUAL("i1", importResult->GetStringAt(0)); + BOOST_CHECK_EQUAL("OK", importResult->GetStringAt(1)); + delete results; +} + +BOOST_AUTO_TEST_CASE(CannotExecuteAnInvalidOperation) +{ + char const* invalid[] = {"inv1", "Invalid", 0}; + AddStatementTo(&instructions, invalid); + + SlimList* results = listExecutor.Execute(&instructions); + BOOST_CHECK_EQUAL(3, results->GetLength()); + + SlimList* invalidStatementResult = results->GetListAt(2); + BOOST_CHECK_EQUAL("inv1", invalidStatementResult->GetStringAt(0)); + BOOST_CHECK_EQUAL("__EXCEPTION__:message:<>", invalidStatementResult->GetStringAt(1)); + + delete results; +} + +BOOST_AUTO_TEST_CASE(CanCallASimpleFunction) +{ + char const* call[] = {"call1", "call", "test_slim", "returnValue", 0}; + AddStatementTo(&instructions, call); + + SlimList* results = listExecutor.Execute(&instructions); + BOOST_CHECK_EQUAL(3, results->GetLength()); + + SlimList* makeResult = results->GetListAt(1); + BOOST_CHECK_EQUAL("m1", makeResult->GetStringAt(0)); + BOOST_CHECK_EQUAL("OK", makeResult->GetStringAt(1)); + + SlimList* callResult = results->GetListAt(2); + BOOST_CHECK_EQUAL("call1", callResult->GetStringAt(0)); + BOOST_CHECK_EQUAL("value", callResult->GetStringAt(1)); + + delete results; +} + +BOOST_AUTO_TEST_CASE(CantExecuteMalformedInstruction) +{ + char const* call[] = {"call1", "call", "notEnoughArguments", 0}; + AddStatementTo(&instructions, call); + + SlimList* results = listExecutor.Execute(&instructions); + SlimList* invalidStatementResult = results->GetListAt(2); + BOOST_CHECK_EQUAL("__EXCEPTION__:message:<>", invalidStatementResult->GetStringAt(1)); + + delete results; +} + +BOOST_AUTO_TEST_CASE(CantCallAmethodOnAnInstanceThatDoesntExist) +{ + char const* call[] = {"call1", "call", "noSuchInstance", "method", 0}; + AddStatementTo(&instructions, call); + + SlimList* results = listExecutor.Execute(&instructions); + SlimList* invalidStatementResult = results->GetListAt(2); + BOOST_CHECK_EQUAL("__EXCEPTION__:message:<>", invalidStatementResult->GetStringAt(1)); + + delete results; +} + +BOOST_AUTO_TEST_CASE(ShouldRespondToAnEmptySetOfInstructionsWithAnEmptySetOfResults) +{ + SlimList* instructions = new SlimList(); + SlimList* results = listExecutor.Execute(instructions); + BOOST_CHECK_EQUAL(0, results->GetLength()); + delete results; + delete instructions; +} + +BOOST_AUTO_TEST_CASE(CanPassArgumentsToConstructor) +{ + char const* make2[] = {"make2", "make", "test_slim2", "TestSlim", "ConstructorArgument", 0}; + char const* call[] = {"call1", "call", "test_slim2", "getConstructionArg", 0}; + AddStatementTo(&instructions, make2); + AddStatementTo(&instructions, call); + + SlimList* results = listExecutor.Execute(&instructions); + SlimList* callResult = results->GetListAt(3); + BOOST_CHECK_EQUAL("ConstructorArgument", callResult->GetStringAt(1)); + + delete results; +} + +BOOST_AUTO_TEST_CASE(CanCallAFunctionMoreThanOnce) +{ + char const* call[] = {"call1", "call", "test_slim", "echo", "Hello", 0}; + AddStatementTo(&instructions, call); + char const* call2[] = {"call2", "call", "test_slim", "echo", "Goodbye", 0}; + AddStatementTo(&instructions, call2); + + SlimList* results = listExecutor.Execute(&instructions); + SlimList* callResult = results->GetListAt(2); + BOOST_CHECK_EQUAL("Hello", callResult->GetStringAt(1)); + + callResult = results->GetListAt(3); + BOOST_CHECK_EQUAL("Goodbye", callResult->GetStringAt(1)); + + delete results; +} + +BOOST_AUTO_TEST_CASE(CanAssignTheReturnValueToASymbol) +{ + char const* call[] = {"id1", "callAndAssign", "v", "test_slim", "add", "x", "y", 0}; + AddStatementTo(&instructions, call); + + char const* call2[] = {"id2", "call", "test_slim", "echo", "$v", 0}; + AddStatementTo(&instructions, call2); + + SlimList* results = listExecutor.Execute(&instructions); + SlimList* callResult = results->GetListAt(2); + BOOST_CHECK_EQUAL("xy", callResult->GetStringAt(1)); + + callResult = results->GetListAt(3); + BOOST_CHECK_EQUAL("xy", callResult->GetStringAt(1)); + + delete results; +} + +BOOST_AUTO_TEST_CASE(CanReplateMultipleSymbolsInASingleArgument) +{ + char const* call[] = {"id1", "callAndAssign", "v1", "test_slim", "echo", "Bob", 0}; + AddStatementTo(&instructions, call); + + char const* call2[] = {"id2", "callAndAssign", "v2", "test_slim", "echo", "Martin", 0}; + AddStatementTo(&instructions, call2); + + char const* call3[] = {"id2", "call", "test_slim", "echo", "name: $v1 $v2 $12.23", 0}; + AddStatementTo(&instructions, call3); + + SlimList* results = listExecutor.Execute(&instructions); + SlimList* callResult = results->GetListAt(4); + BOOST_CHECK_EQUAL("name: Bob Martin $12.23", callResult->GetStringAt(1)); + + delete results; +} + +BOOST_AUTO_TEST_CASE(CanPassAndReturnAList) +{ + SlimList* l = new SlimList(); + l->AddString("1"); + l->AddString("2"); + + SlimList* statement = new SlimList(); + statement->AddString("id1"); + statement->AddString("call"); + statement->AddString("test_slim"); + statement->AddString("echo"); + statement->AddList(l); + + instructions.AddList(statement); + delete statement; + + SlimList* results = listExecutor.Execute(&instructions); + SlimList* callResult = results->GetListAt(2); + SlimList* resultList = callResult->GetListAt(1); + BOOST_CHECK_EQUAL(*l, *resultList); + + delete results; + delete l; +} + +BOOST_AUTO_TEST_CASE(CanReturnNull) +{ + char const* call[] = {"id1", "call", "test_slim", "null", 0}; + AddStatementTo(&instructions, call); + + SlimList* results = listExecutor.Execute(&instructions); + SlimList* callResult = results->GetListAt(2); + BOOST_CHECK_EQUAL("null", callResult->GetStringAt(1)); + + delete results; +} + +BOOST_AUTO_TEST_CASE(CanPassASymbolInAList) +{ + char const* call[] = {"id1", "callAndAssign", "v", "test_slim", "echo", "Bob", 0}; + AddStatementTo(&instructions, call); + + SlimList* statement = new SlimList(); + statement->AddString("id2"); + statement->AddString("call"); + statement->AddString("test_slim"); + statement->AddString("echo"); + + SlimList* l = new SlimList(); + l->AddString("$v"); + statement->AddList(l); + + instructions.AddList(statement); + delete statement; + + SlimList* results = listExecutor.Execute(&instructions); + SlimList* callResult = results->GetListAt(3); + SlimList* resultList = callResult->GetListAt(1); + + SlimList* expected = new SlimList(); + expected->AddString("Bob"); + + BOOST_CHECK_EQUAL(*expected, *resultList); + + delete results; + delete l; + delete expected; +} + +BOOST_AUTO_TEST_SUITE_END() diff --git a/UnitTest/CSlimTests/SlimConnectionHandlerTests.cpp b/UnitTest/CSlimTests/SlimConnectionHandlerTests.cpp new file mode 100644 index 0000000..9f7b3e9 --- /dev/null +++ b/UnitTest/CSlimTests/SlimConnectionHandlerTests.cpp @@ -0,0 +1,88 @@ +#include "stdafx.h" +#include + +#include + +#include + +using namespace Slim; + +namespace +{ + struct MockComLink + { + int Send(char const* msg, int length); + int Receive(char * buffer, int length); + + std::string lastSendMsg; + char const* recvStream; + char const* recvPtr; + }; + + inline + int MockComLink::Send(char const* msg, int length) + { + lastSendMsg = std::string(msg, length); + return length; + } + + inline + int MockComLink::Receive(char * buffer, int length) + { + std::copy(recvPtr, recvPtr + length, buffer); + recvPtr += length; + return length; + } + + std::string slimResponse; + std::string sentSlimMessage; + std::string mock_handle_slim_message(char const* message) + { + sentSlimMessage = message; + return slimResponse; + } +} + +struct InitSlimConnectionHandlerTest +{ + InitSlimConnectionHandlerTest() + : slimConnectionHandler( + boost::bind(&MockComLink::Send, &comLink, _1, _2), + boost::bind(&MockComLink::Receive, &comLink, _1, _2)) + { + slimConnectionHandler.RegisterSlimMessageHandler(mock_handle_slim_message); + } + + ~InitSlimConnectionHandlerTest() + { + } + + MockComLink comLink; + ConnectionHandler slimConnectionHandler; +}; + +BOOST_FIXTURE_TEST_SUITE(SlimConnectionHandlerTestSuite, InitSlimConnectionHandlerTest) + +BOOST_AUTO_TEST_CASE(ShouldSendVersion) +{ + comLink.recvStream = "000003:bye"; + comLink.recvPtr = comLink.recvStream; + + slimConnectionHandler.Run(); + + BOOST_CHECK_EQUAL("Slim -- V0.0\n", comLink.lastSendMsg); +} + +BOOST_AUTO_TEST_CASE(ShouldReadMessageAndCallSlimHandler) +{ + comLink.recvStream = "000006:abcdef000003:bye"; + comLink.recvPtr = comLink.recvStream; + + slimResponse = "ghijklm"; + slimConnectionHandler.Run(); + + BOOST_CHECK_EQUAL("000007:ghijklm", comLink.lastSendMsg); + BOOST_CHECK_EQUAL("abcdef", sentSlimMessage); +} + +BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file diff --git a/UnitTest/CSlimTests/SlimListDeserializerTests.cpp b/UnitTest/CSlimTests/SlimListDeserializerTests.cpp new file mode 100644 index 0000000..af1fbce --- /dev/null +++ b/UnitTest/CSlimTests/SlimListDeserializerTests.cpp @@ -0,0 +1,108 @@ +#include "stdafx.h" +#include + +using namespace Slim; + +BOOST_TEST_DONT_PRINT_LOG_VALUE(SlimList); + +struct InitSlimListDeserializerTest +{ + InitSlimListDeserializerTest() + : deserializedList(0) + { + } + + ~InitSlimListDeserializerTest() + { + delete deserializedList; + } + + SlimList slimList; + SlimList* deserializedList; + std::string serializedList; +}; + +BOOST_FIXTURE_TEST_SUITE(SlimListDeserializerTestSuite, InitSlimListDeserializerTest) + + +BOOST_AUTO_TEST_CASE(DeserializeEmptyList) +{ + deserializedList = SlimList::Deserialize("[000000:]"); + BOOST_CHECK(deserializedList); + BOOST_CHECK_EQUAL(0, deserializedList->GetLength()); +} + +BOOST_AUTO_TEST_CASE(DeserializeEmptyString) +{ + SlimList* list = SlimList::Deserialize(""); + BOOST_CHECK(!list); +} + +BOOST_AUTO_TEST_CASE(MissingOpenBracketReturnsNull) +{ + SlimList* list = SlimList::Deserialize("hello"); + BOOST_CHECK(!list); +} + +BOOST_AUTO_TEST_CASE(MissingClosingBracketReturnsNull) +{ + SlimList* list = SlimList::Deserialize("[000000:"); + BOOST_CHECK(!list); +} + +BOOST_AUTO_TEST_CASE(CanDeserializeCanonicalListWithOneElement) +{ + char const* canonicalList = "[000001:000008:Hi doug.:]"; + deserializedList = SlimList::Deserialize(canonicalList); + BOOST_CHECK(deserializedList); + BOOST_CHECK_EQUAL(1, deserializedList->GetLength()); + BOOST_CHECK_EQUAL("Hi doug.", deserializedList->GetStringAt(0)); +} + +BOOST_AUTO_TEST_CASE(CanDeSerializeListWithOneElement) +{ + slimList.AddString("hello"); + serializedList = SlimList::Serialize(&slimList); + deserializedList = SlimList::Deserialize(serializedList); + BOOST_CHECK(deserializedList); + BOOST_CHECK_EQUAL(slimList, *deserializedList); +} + +BOOST_AUTO_TEST_CASE(CanDeSerializeListWithTwoElements) +{ + slimList.AddString("hello"); + slimList.AddString("bob"); + serializedList = SlimList::Serialize(&slimList); + deserializedList = SlimList::Deserialize(serializedList); + BOOST_CHECK(deserializedList); + BOOST_CHECK_EQUAL(slimList, *deserializedList); +} + +BOOST_AUTO_TEST_CASE(CanAddSubList) +{ + SlimList* embeddedList = new SlimList(); + embeddedList->AddString("element"); + slimList.AddList(embeddedList); + serializedList = SlimList::Serialize(&slimList); + deserializedList = SlimList::Deserialize(serializedList); + SlimList* subList = deserializedList->GetListAt(0); + subList = deserializedList->GetListAt(0); + BOOST_CHECK_EQUAL(*embeddedList, *subList); + + delete embeddedList; +} + +BOOST_AUTO_TEST_CASE(GetStringWhereThereIsAList) +{ + SlimList* embeddedList = new SlimList(); + embeddedList->AddString("element"); + slimList.AddList(embeddedList); + serializedList = SlimList::Serialize(&slimList); + deserializedList = SlimList::Deserialize(serializedList); + std::string string = deserializedList->GetStringAt(0); + BOOST_CHECK_EQUAL("[000001:000007:element:]", string); + + delete embeddedList; +} + +BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file diff --git a/UnitTest/CSlimTests/SlimListSerializerTests.cpp b/UnitTest/CSlimTests/SlimListSerializerTests.cpp new file mode 100644 index 0000000..f66f7e3 --- /dev/null +++ b/UnitTest/CSlimTests/SlimListSerializerTests.cpp @@ -0,0 +1,101 @@ +#include "stdafx.h" +#include + +using namespace Slim; + +BOOST_TEST_DONT_PRINT_LOG_VALUE(SlimList); + +struct InitSlimListSerializerTest +{ + InitSlimListSerializerTest() + { + } + + ~InitSlimListSerializerTest() + { + } + + SlimList slimList; + std::string serializedList; +}; + +BOOST_FIXTURE_TEST_SUITE(SlimListSerializerTestSuite, InitSlimListSerializerTest) + +BOOST_AUTO_TEST_CASE(SerializeAListWithNoElements) +{ + serializedList = SlimList::Serialize(&slimList); + BOOST_CHECK_EQUAL("[000000:]", serializedList); +} + +BOOST_AUTO_TEST_CASE(SerializeAListWithOneElements) +{ + slimList.AddString("hello"); + serializedList = SlimList::Serialize(&slimList); + BOOST_CHECK_EQUAL("[000001:000005:hello:]", serializedList); +} + +BOOST_AUTO_TEST_CASE(SerializeAListWithTwoElements) +{ + slimList.AddString("hello"); + slimList.AddString("world"); + + serializedList = SlimList::Serialize(&slimList); + BOOST_CHECK_EQUAL("[000002:000005:hello:000005:world:]", serializedList); +} + +BOOST_AUTO_TEST_CASE(ListCopysItsString) +{ + char string[12] = "Hello"; + slimList.AddString(string); + strcpy_s(string, "Goodbye"); + serializedList = SlimList::Serialize(&slimList); + BOOST_CHECK_EQUAL("[000001:000005:Hello:]", serializedList); +} + +BOOST_AUTO_TEST_CASE(CanCopyAList) +{ + slimList.AddString("123456"); + slimList.AddString("987654"); + + SlimList* copy = new SlimList(); + for (int i = 0; i < slimList.GetLength(); ++i) + { + std::string string = slimList.GetStringAt(i); + copy->AddString(string); + } + std::string serialCopy = SlimList::Serialize(copy); + std::string serialSlimList = SlimList::Serialize(&slimList); + BOOST_CHECK_EQUAL(serialCopy, serialSlimList); + + delete copy; +} + +BOOST_AUTO_TEST_CASE(SerializeNestedList) +{ + SlimList* embeddedList = new SlimList(); + embeddedList->AddString("element"); + slimList.AddList(embeddedList); + serializedList = SlimList::Serialize(&slimList); + BOOST_CHECK_EQUAL("[000001:000024:[000001:000007:element:]:]", serializedList); + delete embeddedList; +} + +BOOST_AUTO_TEST_CASE(SerializedLength) +{ + slimList.AddString("12345"); + BOOST_CHECK_EQUAL(5 + 17, SlimList::SerializedLength(&slimList)); + slimList.AddString("123456"); + BOOST_CHECK_EQUAL(9 + (5+8) + (6+8), SlimList::SerializedLength(&slimList)); + serializedList = SlimList::Serialize(&slimList); + BOOST_CHECK_EQUAL(9 + (5+8) + (6+8), serializedList.size()); +} + +BOOST_AUTO_TEST_CASE(SerializeNull) +{ + slimList.AddString(""); + serializedList = SlimList::Serialize(&slimList); + BOOST_CHECK_EQUAL("[000001:000004:null:]", serializedList); + +} + +BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file diff --git a/UnitTest/CSlimTests/SlimListTests.cpp b/UnitTest/CSlimTests/SlimListTests.cpp new file mode 100644 index 0000000..976fd85 --- /dev/null +++ b/UnitTest/CSlimTests/SlimListTests.cpp @@ -0,0 +1,151 @@ +#include "stdafx.h" +#include + +using namespace Slim; + +BOOST_TEST_DONT_PRINT_LOG_VALUE(SlimList); + +struct InitSlimListTest +{ + InitSlimListTest() + { + } + + ~InitSlimListTest() + { + } + + SlimList slimList; +}; + +BOOST_FIXTURE_TEST_SUITE(SlimListTestSuite, InitSlimListTest) + +BOOST_AUTO_TEST_CASE(TwoEmptyListsAreEqual) +{ + SlimList* list = new SlimList(); + BOOST_CHECK_EQUAL(slimList, *list); + delete list; +} + +BOOST_AUTO_TEST_CASE(TwoDifferentLenghtListsAreNotEqual) +{ + SlimList* list = new SlimList(); + slimList.AddString("hello"); + BOOST_CHECK_NE(slimList, *list); + delete list; +} + +BOOST_AUTO_TEST_CASE(TwoSingleElementListsWithDifferentElmementsAreNotEqual) +{ + SlimList* list = new SlimList(); + slimList.AddString("hello"); + list->AddString("goodbye"); + BOOST_CHECK_NE(slimList, *list); + delete list; +} + +BOOST_AUTO_TEST_CASE(TwoIdenticalMultipleElementListsElmementsAreEqual) +{ + SlimList* list = new SlimList(); + slimList.AddString("hello"); + slimList.AddString("goodbye"); + list->AddString("hello"); + list->AddString("goodbye"); + BOOST_CHECK_EQUAL(slimList, *list); + delete list; +} + +BOOST_AUTO_TEST_CASE(TwoNonIdenticalMultipleElementListsElmementsAreNotEqual) +{ + SlimList* list = new SlimList(); + slimList.AddString("hello"); + slimList.AddString("hello"); + list->AddString("goodbye"); + list->AddString("goodbye"); + BOOST_CHECK_NE(slimList, *list); + delete list; +} + +BOOST_AUTO_TEST_CASE(CanGetElements) +{ + slimList.AddString("element1"); + slimList.AddString("element2"); + BOOST_CHECK_EQUAL("element1", slimList.GetStringAt(0)); + BOOST_CHECK_EQUAL("element2", slimList.GetStringAt(1)); +} + +BOOST_AUTO_TEST_CASE(CanGetHashWithOneElement) +{ + slimList.AddString("
namebob
"); + + SlimList* hash = slimList.GetHashAt(0); + SlimList* twoElementList = hash->GetListAt(0); + + BOOST_CHECK_EQUAL("name", twoElementList->GetStringAt(0)); + BOOST_CHECK_EQUAL("bob", twoElementList->GetStringAt(1)); + + delete hash; +} + +BOOST_AUTO_TEST_CASE(CanGetHashWithMultipleElements) +{ + slimList.AddString("
namedough
addrhere
"); + + SlimList* hash = slimList.GetHashAt(0); + SlimList* twoElementList = hash->GetListAt(1); + + BOOST_CHECK_EQUAL("addr", twoElementList->GetStringAt(0)); + BOOST_CHECK_EQUAL("here", twoElementList->GetStringAt(1)); + + delete hash; +} + +BOOST_AUTO_TEST_CASE(CannotGetElementThatAreNotThere) +{ + slimList.AddString("element1"); + slimList.AddString("element2"); + BOOST_CHECK(slimList.GetStringAt(3).empty()); +} + +BOOST_AUTO_TEST_CASE(CanReplaceString) +{ + slimList.AddString("replaceMe"); + slimList.ReplaceAt(0, "WithMe"); + BOOST_CHECK_EQUAL("WithMe", slimList.GetStringAt(0)); +} + +BOOST_AUTO_TEST_CASE(CanGetTail) +{ + slimList.AddString("1"); + slimList.AddString("2"); + slimList.AddString("3"); + slimList.AddString("4"); + + SlimList* expected = new SlimList(); + expected->AddString("3"); + expected->AddString("4"); + + SlimList* tail = slimList.GetTailAt(2); + BOOST_CHECK_EQUAL(*expected, *tail); + + delete tail; + delete expected; +} + +BOOST_AUTO_TEST_CASE(RecursiveToString) +{ + slimList.AddString("a"); + slimList.AddString("b"); + + SlimList* sublist = new SlimList(); + sublist->AddString("3"); + sublist->AddString("4"); + + slimList.AddList(sublist); + + BOOST_CHECK_EQUAL("[\"a\", \"b\", [\"3\", \"4\"]]", slimList.ToString()); + + delete sublist; +} + +BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file diff --git a/UnitTest/CSlimTests/StatementExecutorTests.cpp b/UnitTest/CSlimTests/StatementExecutorTests.cpp new file mode 100644 index 0000000..4c9f63b --- /dev/null +++ b/UnitTest/CSlimTests/StatementExecutorTests.cpp @@ -0,0 +1,237 @@ +#include "stdafx.h" + +#include +#include + +#include + +using namespace Slim; + +BOOST_TEST_DONT_PRINT_LOG_VALUE(SlimList); + +extern void AddFixtures(StatementExecutor*); + +struct InitStatementExecutorTest +{ + InitStatementExecutorTest() + { + AddFixtures(&statementExecutor); + statementExecutor.Make("test_slim", "TestSlim", &empty); + } + + ~InitStatementExecutorTest() + { + } + + StatementExecutor statementExecutor; + SlimList args; + SlimList empty; +}; + +BOOST_FIXTURE_TEST_SUITE(StatementExecutorTestSuite, InitStatementExecutorTest) + + +BOOST_AUTO_TEST_CASE(CantCallFunctionThatDoesNotExist) +{ + std::string result = statementExecutor.Call("test_slim", "noSuchMethod", &args); + BOOST_CHECK_EQUAL("__EXCEPTION__:message:<>", result); + + result = statementExecutor.Call("test_slim", "noOtherSuchMethod", &args); + BOOST_CHECK_EQUAL("__EXCEPTION__:message:<>", result); +} + +BOOST_AUTO_TEST_CASE(ShouldTruncateReallyLongNamedFunctionThatDoesNotExistTo32) +{ + std::string result = statementExecutor.Call("test_slim", "noOtherSuchMethod123456789022345678903234567890423456789052345678906234567890", &args); + BOOST_CHECK(result.size() < 120); + BOOST_CHECK_EQUAL("__EXCEPTION__:message:<>", result); +} + +BOOST_AUTO_TEST_CASE(ShouldKnowNumberofArgumentsforNonExistantFunction) +{ + args.AddString("BlahBlah"); + std::string result = statementExecutor.Call("test_slim", "noSuchMethod", &args); + BOOST_CHECK_EQUAL("__EXCEPTION__:message:<>", result); +} + +BOOST_AUTO_TEST_CASE(ShouldNotAllowACallToaNonexistentInstance) +{ + std::string result = statementExecutor.Call("noSuchInstance", "noArgs", &args); + BOOST_CHECK_EQUAL("__EXCEPTION__:message:<>", result); +} + +BOOST_AUTO_TEST_CASE(ShouldNotAllowAMakeOnANonexistentClass) +{ + std::string result = statementExecutor.Make("instanceName", "NoSuchClass", &empty); + BOOST_CHECK_EQUAL("__EXCEPTION__:message:<>", result); +} + +BOOST_AUTO_TEST_CASE(CanCallaMethodThatReturnsAValue) +{ + std::string result = statementExecutor.Call("test_slim", "returnValue", &args); + BOOST_CHECK_EQUAL("value", result); +} + +BOOST_AUTO_TEST_CASE(CanCallaMethodThatTakesASlimList) +{ + args.AddString("hello world"); + std::string result = statementExecutor.Call("test_slim", "echo", &args); + BOOST_CHECK_EQUAL("hello world", result); +} + +BOOST_AUTO_TEST_CASE(CanCallTwoInstancesOfTheSameFixture) +{ + args.AddString("one"); + SlimList* args2 = new SlimList(); + args2->AddString("two"); + + statementExecutor.Make("test_slim2", "TestSlim", &empty); + statementExecutor.Call("test_slim", "setArg", &args); + statementExecutor.Call("test_slim2", "setArg", args2); + std::string one = statementExecutor.Call("test_slim", "getArg", &empty); + std::string two = statementExecutor.Call("test_slim2", "getArg", &empty); + BOOST_CHECK_EQUAL("one", one); + BOOST_CHECK_EQUAL("two", two); + delete args2; +} + +BOOST_AUTO_TEST_CASE(CanCreateTwoDifferentFixtures) +{ + args.AddString("one"); + SlimList* args2 = new SlimList(); + args2->AddString("two"); + + statementExecutor.Make("test_slim2", "TestSlimAgain", &empty); + statementExecutor.Call("test_slim", "setArg", &args); + statementExecutor.Call("test_slim2", "setArgAgain", args2); + std::string one = statementExecutor.Call("test_slim", "getArg", &empty); + std::string two = statementExecutor.Call("test_slim2", "getArgAgain", &empty); + BOOST_CHECK_EQUAL("one", one); + BOOST_CHECK_EQUAL("two", two); + delete args2; +} + +BOOST_AUTO_TEST_CASE(CanReplaceSymbolsInSubLists) +{ + statementExecutor.SetSymbol("v2", "doug"); + SlimList* subList = new SlimList(); + subList->AddString("Hi $v2."); + args.AddList(subList); + + std::string result = statementExecutor.Call("test_slim", "echo", &args); + BOOST_CHECK(!result.empty()); + SlimList* returnedList = SlimList::Deserialize(result); + BOOST_CHECK(returnedList); + BOOST_CHECK_EQUAL(1, returnedList->GetLength()); + std::string element = returnedList->GetStringAt(0); + BOOST_CHECK_EQUAL("Hi doug.", element); + delete subList; + delete returnedList; +} + +BOOST_AUTO_TEST_CASE(CanReplaceSymbolsInSubSubLists) +{ + statementExecutor.SetSymbol("v2", "doug"); + SlimList* subList = new SlimList(); + SlimList* subSubList = new SlimList(); + subSubList->AddString("Hi $v2."); + subList->AddList(subSubList); + args.AddList(subList); + + std::string result = statementExecutor.Call("test_slim", "echo", &args); + BOOST_CHECK(!result.empty()); + SlimList* returnedSubList = SlimList::Deserialize(result); + BOOST_CHECK(returnedSubList); + BOOST_CHECK_EQUAL(1, returnedSubList->GetLength()); + SlimList* returnedSubSubList = returnedSubList->GetListAt(0); + BOOST_CHECK(returnedSubSubList); + BOOST_CHECK_EQUAL(1, returnedSubSubList->GetLength()); + std::string element = returnedSubSubList->GetStringAt(0); + BOOST_CHECK(!element.empty()); + BOOST_CHECK_EQUAL("Hi doug.", element); + + delete subSubList; + delete subList; + delete returnedSubList; +} + +BOOST_AUTO_TEST_CASE(CanCreateFixtureWithArguments) +{ + SlimList* constructionArgs = new SlimList(); + constructionArgs->AddString("hi"); + statementExecutor.Make("test_slim", "TestSlim", constructionArgs); + std::string result = statementExecutor.Call("test_slim", "getConstructionArg", &empty); + BOOST_CHECK_EQUAL("hi", result); + + delete constructionArgs; +} + +BOOST_AUTO_TEST_CASE(CanCreateFixtureWithArgumentsThatHaveSymbols) +{ + statementExecutor.SetSymbol("name", "doug"); + SlimList* constructionArgs = new SlimList(); + constructionArgs->AddString("hi $name"); + statementExecutor.Make("test_slim", "TestSlim", constructionArgs); + std::string result = statementExecutor.Call("test_slim", "getConstructionArg", &empty); + BOOST_CHECK_EQUAL("hi doug", result); + + delete constructionArgs; +} + +BOOST_AUTO_TEST_CASE(CanCreateFixtureWithArgumentsThatHaveMultipleSymbols) +{ + statementExecutor.SetSymbol("fname", "doug"); + statementExecutor.SetSymbol("lname", "bradbury"); + + SlimList* constructionArgs = new SlimList(); + constructionArgs->AddString("hi $fname $lname"); + statementExecutor.Make("test_slim", "TestSlim", constructionArgs); + std::string result = statementExecutor.Call("test_slim", "getConstructionArg", &empty); + BOOST_CHECK_EQUAL("hi doug bradbury", result); + + delete constructionArgs; +} + +BOOST_AUTO_TEST_CASE(FixtureConstructionFailsWithUserErrorMessage) +{ + SlimList* constructionArgs = new SlimList(); + constructionArgs->AddString("hi doug"); + constructionArgs->AddString("ho doug"); + + std::string result = statementExecutor.Make("test_slim", "TestSlim", constructionArgs); + BOOST_CHECK_EQUAL("__EXCEPTION__:message:<>", result); + + delete constructionArgs; +} + +BOOST_AUTO_TEST_CASE(FixtureCanReturnError) +{ + std::string result = statementExecutor.Call("test_slim", "returnError", &args); + BOOST_CHECK_EQUAL("__EXCEPTION__:message:<>", result); +} + +BOOST_AUTO_TEST_CASE(CanHaveNullResult) +{ + std::string result = statementExecutor.Call("test_slim", "null", &args); + BOOST_CHECK(result.empty()); +} + +#if 0 +BOOST_AUTO_TEST_CASE(CanCallFixtureDeclaredBackwards) +{ + statementExecutor.Make("backwardsTestSlim", "TestSlimDeclaredLate", &empty); + SlimList_AddString(args, "hi doug"); + char* result = statementExecutor.Call("backwardsTestSlim", "echo", args); + BOOST_CHECK_EQUAL("hi doug", result); +} + +BOOST_AUTO_TEST_CASE(StatementExecutor, canCallFixtureNotDeclared) +{ + statementExecutor.Make("undeclaredTestSlim", "TestSlimUndeclared", empty); + SlimList_AddString(args, "hi doug"); + char* result = statementExecutor.Call("undeclaredTestSlim", "echo", args); + BOOST_CHECK_EQUAL("hi doug", result); +} +#endif + +BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file diff --git a/UnitTest/CSlimTests/SymbolTableTests.cpp b/UnitTest/CSlimTests/SymbolTableTests.cpp new file mode 100644 index 0000000..6d12383 --- /dev/null +++ b/UnitTest/CSlimTests/SymbolTableTests.cpp @@ -0,0 +1,86 @@ +#include "stdafx.h" +#include + +struct InitSymbolTableTest +{ + InitSymbolTableTest() + { + } + + ~InitSymbolTableTest() + { + } + + Slim::SymbolTable symbolTable; +}; + +BOOST_FIXTURE_TEST_SUITE(SymbolTableTestSuite, InitSymbolTableTest) + +BOOST_AUTO_TEST_CASE(FindNonExistentSymbolShouldReturnFalse) +{ + BOOST_CHECK(!symbolTable.Find("Hey")); +} + +BOOST_AUTO_TEST_CASE(GetNonExistentSymbolShouldThrow) +{ + BOOST_CHECK_THROW(symbolTable.GetValue("Hey"), std::exception); +} + +BOOST_AUTO_TEST_CASE(GetExistingSymbolShouldNotThrow) +{ + symbolTable.SetValue("Hey", "You"); + BOOST_CHECK(symbolTable.Find("Hey")); + BOOST_CHECK_NO_THROW(symbolTable.GetValue("Hey")); + BOOST_CHECK_EQUAL("You", symbolTable.GetValue("Hey")); +} + +BOOST_AUTO_TEST_CASE(CanReplaceSymbolsWithTheirValue) +{ + symbolTable.SetValue("v", "bob"); + std::string input("hi $v."); + std::string result = symbolTable.ReplaceStringFrom(input, input); + BOOST_CHECK_EQUAL(result, "hi bob."); +} + +BOOST_AUTO_TEST_CASE(CanReplaceSymbolsInTheMiddle) +{ + symbolTable.SetValue("v", "bob"); + std::string input("hi $v whats up."); + std::string result = symbolTable.ReplaceStringFrom(input, input); + BOOST_CHECK_EQUAL(result, "hi bob whats up."); +} + +BOOST_AUTO_TEST_CASE(CanReplaceSymbolsWithOtherNonAlphaNumeric) +{ + symbolTable.SetValue("v2", "bob"); + std::string input("$v2=why"); + std::string result = symbolTable.ReplaceStringFrom(input, input); + BOOST_CHECK_EQUAL(result, "bob=why"); +} + +BOOST_AUTO_TEST_CASE(CanReplaceMultipleSymbolsWithTheirValue) +{ + symbolTable.SetValue("v", "bob"); + symbolTable.SetValue("e", "doug"); + std::string input("hi $v. Cost: $12.32 from $e."); + std::string result = symbolTable.ReplaceStringFrom(input, input); + BOOST_CHECK_EQUAL(result, "hi bob. Cost: $12.32 from doug."); +} + +BOOST_AUTO_TEST_CASE(CanHandleStringWithJustADollarSign) +{ + symbolTable.SetValue("v2", "bob"); + std::string input("$"); + std::string result = symbolTable.ReplaceStringFrom(input, input); + BOOST_CHECK_EQUAL(result, "$"); +} + +BOOST_AUTO_TEST_CASE(CanHandleDollarSignAtTheEndOfTheString) +{ + symbolTable.SetValue("v2", "doug"); + std::string input("hi $v2$"); + std::string result = symbolTable.ReplaceStringFrom(input, input); + BOOST_CHECK_EQUAL(result, "hi doug$"); +} + +BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file diff --git a/UnitTest/CSlimTests/TestFixture.cpp b/UnitTest/CSlimTests/TestFixture.cpp new file mode 100644 index 0000000..c120d8a --- /dev/null +++ b/UnitTest/CSlimTests/TestFixture.cpp @@ -0,0 +1,14 @@ +#include "stdafx.h" + +#include "TestSlim.h" +#include "TestSlimAgain.h" +#include "Fixtures.h" + +#include +#include + +SLIM_FIXTURES + SLIM_FIXTURE(TestSlim) + SLIM_FIXTURE(TestSlimAgain) +SLIM_END + diff --git a/UnitTest/CSlimTests/TestSlim.cpp b/UnitTest/CSlimTests/TestSlim.cpp new file mode 100644 index 0000000..dfa6893 --- /dev/null +++ b/UnitTest/CSlimTests/TestSlim.cpp @@ -0,0 +1,90 @@ +#include "stdafx.h" + +#include "TestSlim.h" +#include "Fixtures.h" + +#include +#include + +SLIM_BEGIN_FIXTURE(TestSlim) + SLIM_FUNCTION(returnValue) + SLIM_FUNCTION(noArgs) + SLIM_FUNCTION(echo) + SLIM_FUNCTION(add) + SLIM_FUNCTION(null) + SLIM_FUNCTION(setArg) + SLIM_FUNCTION(getArg) + SLIM_FUNCTION(getConstructionArg) + SLIM_FUNCTION(returnError) +SLIM_END_FIXTURE + + +Slim::FixtureIntf* TestSlim::Create(Slim::StatementExecutor* executor, Slim::SlimList* args) +{ + if (args->GetLength() > 1) + { + executor->ConstructorError("xxx"); + return 0; + } + + return new TestSlim(executor, args); +} + +TestSlim::TestSlim(Slim::StatementExecutor* executor, Slim::SlimList* args) + : statementExecutor(executor) + , constructionArg(args->GetStringAt(0)) +{ +} + +void TestSlim::Destroy() +{ + delete this; +} + + +std::string TestSlim::noArgs(Slim::SlimList* args) +{ + noArgsCalled = 1; + return "/__VOID__/"; +} + +std::string TestSlim::returnValue(Slim::SlimList* args) +{ + return "value"; +} + +std::string TestSlim::echo(Slim::SlimList* args) +{ + return args->GetStringAt(0); +} + +std::string TestSlim::add(Slim::SlimList* args) +{ + return (boost::format("%1%%2%") % args->GetStringAt(0) % args->GetStringAt(1)).str(); +} + +std::string TestSlim::null(Slim::SlimList* args) +{ + return std::string(); +} + +std::string TestSlim::setArg(Slim::SlimList* args) +{ + arg = args->GetStringAt(0); + return "/__VOID__/"; +} + +std::string TestSlim::getArg(Slim::SlimList* args) +{ + return arg; +} + +std::string TestSlim::getConstructionArg(Slim::SlimList* args) +{ + return constructionArg; +} + +std::string TestSlim::returnError(Slim::SlimList* args) +{ + return statementExecutor->FixtureError("my exception"); +} diff --git a/UnitTest/CSlimTests/TestSlim.h b/UnitTest/CSlimTests/TestSlim.h new file mode 100644 index 0000000..6e4ff70 --- /dev/null +++ b/UnitTest/CSlimTests/TestSlim.h @@ -0,0 +1,35 @@ +#pragma once + +#include "Fixture.h" + +class TestSlim : public Slim::FixtureBase +{ +public: + typedef Slim::FixtureBase tSuper; + + TestSlim(Slim::StatementExecutor* executor, Slim::SlimList* args); + + virtual void Destroy(); + +private: + friend tSuper; + + static Slim::FixtureIntf* Create(Slim::StatementExecutor* executor, Slim::SlimList* args); + + // Fixture methods + std::string returnValue(Slim::SlimList* args); + std::string noArgs(Slim::SlimList* args); + std::string echo(Slim::SlimList* args); + std::string add(Slim::SlimList* args); + std::string null(Slim::SlimList* args); + std::string setArg(Slim::SlimList* args); + std::string getArg(Slim::SlimList* args); + std::string getConstructionArg(Slim::SlimList* args); + std::string returnError(Slim::SlimList* args); + + int noArgsCalled; + std::string constructionArg; + std::string arg; + char echoBuf[50]; + Slim::StatementExecutor* statementExecutor; +}; diff --git a/UnitTest/CSlimTests/TestSlimAgain.cpp b/UnitTest/CSlimTests/TestSlimAgain.cpp new file mode 100644 index 0000000..8b2090c --- /dev/null +++ b/UnitTest/CSlimTests/TestSlimAgain.cpp @@ -0,0 +1,34 @@ +#include "stdafx.h" + +#include "TestSlimAgain.h" +#include "Fixtures.h" + +#include +#include + +SLIM_BEGIN_FIXTURE(TestSlimAgain) + SLIM_FUNCTION(setArgAgain) + SLIM_FUNCTION(getArgAgain) +SLIM_END_FIXTURE + + +Slim::FixtureIntf* TestSlimAgain::Create(Slim::StatementExecutor* executor, Slim::SlimList* args) +{ + return new TestSlimAgain(); +} + +void TestSlimAgain::Destroy() +{ + delete this; +} + +std::string TestSlimAgain::setArgAgain(Slim::SlimList* args) +{ + arg = args->GetStringAt(0); + return "/__VOID__/"; +} + +std::string TestSlimAgain::getArgAgain(Slim::SlimList* args) +{ + return arg; +} diff --git a/UnitTest/CSlimTests/TestSlimAgain.h b/UnitTest/CSlimTests/TestSlimAgain.h new file mode 100644 index 0000000..70bb2f3 --- /dev/null +++ b/UnitTest/CSlimTests/TestSlimAgain.h @@ -0,0 +1,22 @@ +#pragma once + +#include "Fixture.h" + +class TestSlimAgain : public Slim::FixtureBase +{ +public: + typedef Slim::FixtureBase tSuper; + + virtual void Destroy(); + +private: + friend tSuper; + + static Slim::FixtureIntf* Create(Slim::StatementExecutor* executor, Slim::SlimList* args); + + // Fixture methods + std::string setArgAgain(Slim::SlimList* args); + std::string getArgAgain(Slim::SlimList* args); + + std::string arg; +}; diff --git a/UnitTest/CSlimTests/stdafx.cpp b/UnitTest/CSlimTests/stdafx.cpp new file mode 100644 index 0000000..dec95ad --- /dev/null +++ b/UnitTest/CSlimTests/stdafx.cpp @@ -0,0 +1,19 @@ +// +#define BOOST_TEST_DYN_LINK +#define BOOST_TEST_MODULE CSlim Unit Test + +#include "stdafx.h" + +// +struct GlobalInit +{ + GlobalInit() + { + } + + ~GlobalInit() + { + } +}; + +BOOST_GLOBAL_FIXTURE(GlobalInit); \ No newline at end of file diff --git a/UnitTest/CSlimTests/stdafx.h b/UnitTest/CSlimTests/stdafx.h new file mode 100644 index 0000000..8c1264b --- /dev/null +++ b/UnitTest/CSlimTests/stdafx.h @@ -0,0 +1,12 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#include "targetver.h" +#include +#include + +#include diff --git a/UnitTest/CSlimTests/targetver.h b/UnitTest/CSlimTests/targetver.h new file mode 100644 index 0000000..87c0086 --- /dev/null +++ b/UnitTest/CSlimTests/targetver.h @@ -0,0 +1,8 @@ +#pragma once + +// Including SDKDDKVer.h defines the highest available Windows platform. + +// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and +// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. + +#include diff --git a/build/CSlimServerMakefile b/build/CSlimServerMakefile deleted file mode 100644 index 59de2c9..0000000 --- a/build/CSlimServerMakefile +++ /dev/null @@ -1,37 +0,0 @@ -#--------- -# -# CSlimMakefile -# -# This file is designed to be included by the CppUTest ComponentMakefile -# Its goal is to make a cslim server executable. -# -# Cause it to be included by setting the OTHER_MAKEFILE_TO_INCLUDE symbol -# before including the CppUTest ComponentMakefile. Set it like this: -# -# OTHER_MAKEFILE_TO_INCLUDE = $(CSLIM_HOME)/build/CSlimServerMakefile -# -# -# Inputs: -# COMPONENT_NAME -# CSLIM_SRC_DIRS -# USER_LIBS -#---------- - - -#Derived -CSLIM_TARGET = $(COMPONENT_NAME)_cslim -STUFF_TO_CLEAN += $(CSLIM_TARGET) $(CSLIM_TARGET).exe - -CSLIM_SRC = $(call get_src_from_dir_list, $(CSLIM_SRC_DIRS)) -CSLIM_OBJS = $(call src_to_o,$(CSLIM_SRC)) -STUFF_TO_CLEAN += $(CSLIM_OBJS) -ALL_SRC += $(CSLIM_SRC) - -#Other stuff needed -CSLIM_LIB = $(CSLIM_HOME)/lib/libCSlim.a - -$(CSLIM_TARGET): $(CSLIM_OBJS) $(MOCKS_OBJS) $(TARGET_LIB) $(USER_LIBS) $(CPPUTEST_LIB) $(CSLIM_LIB) - $(SILENCE)echo Linking $@ - $(SILENCE)$(CXX) $(CPPFLAGS) $^ $(LDFLAGS) -o $@ - - diff --git a/cslim.pde b/cslim.pde deleted file mode 100644 index cd7690c..0000000 --- a/cslim.pde +++ /dev/null @@ -1,54 +0,0 @@ -#include - -#include -#include -#include -#include -#include "TcpComLink.h" - -extern "C" { - #include "Slim.h" -} - -Slim * slim; -Server server(22); -byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; -byte ip[] = { 192,168,1, 177 }; -byte gateway[] = { 192,168,1, 1 }; -byte subnet[] = { 255, 255, 255, 0 }; - -void setup() -{ - slim = Slim_Create(); - - Ethernet.begin(mac, ip, gateway, subnet); - server.begin(); - - Serial.begin(9600); - Serial.write("Slim running\n"); - -} - - -void loop_ethernet() -{ - Client client = server.available(); - if (client) { - Serial.write("New Connection\n"); - TcpComLink * comLink = TcpComLink_Create(&client); - Slim_HandleConnection(slim, (void*)comLink, &TcpComLink_send, &TcpComLink_recv); - TcpComLink_Destroy(comLink); - } -} - -#include "SerialComLink.h" -void loop_serial() -{ - Slim_HandleConnection(slim, (void*)0, &SerialComLink_send, &SerialComLink_recv); -} - -void loop() -{ - loop_ethernet(); -} - diff --git a/cslim/CSlim.sln b/cslim/CSlim.sln new file mode 100644 index 0000000..8830f61 --- /dev/null +++ b/cslim/CSlim.sln @@ -0,0 +1,25 @@ +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CSlim", "CSlim.vcxproj", "{5BE24E31-6003-4EAE-876A-96495093B3AC}" +EndProject +Global + GlobalSection(SourceCodeControl) = preSolution + SccNumberOfProjects = 2 + SccLocalPath0 = . + SccProjectUniqueName1 = CSlim.vcxproj + SccLocalPath1 = . + EndGlobalSection + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5BE24E31-6003-4EAE-876A-96495093B3AC}.Debug|Win32.ActiveCfg = Debug|Win32 + {5BE24E31-6003-4EAE-876A-96495093B3AC}.Debug|Win32.Build.0 = Debug|Win32 + {5BE24E31-6003-4EAE-876A-96495093B3AC}.Release|Win32.ActiveCfg = Release|Win32 + {5BE24E31-6003-4EAE-876A-96495093B3AC}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/cslim/CSlim.vcxproj b/cslim/CSlim.vcxproj new file mode 100644 index 0000000..39e3ba7 --- /dev/null +++ b/cslim/CSlim.vcxproj @@ -0,0 +1,118 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {5BE24E31-6003-4EAE-876A-96495093B3AC} + CSlim + + + + + + + + + + + + StaticLibrary + true + Unicode + + + StaticLibrary + false + true + Unicode + + + + + + + + + + + + + $(SolutionDir)$(Configuration)\ + C:\Program Files %28x86%29\boost\boost_1_48_0;$(IncludePath) + + + $(SolutionDir)$(Configuration)\ + C:\Program Files %28x86%29\boost\boost_1_47;$(IncludePath) + + + + Level3 + Disabled + $(ProjectDir)include\cslim;$(ProjectDir)include\com;$(ProjectDir)include\vs2010;C:\Program Files %28x86%29\boost\boost_1_47;%(AdditionalIncludeDirectories) + CPP_COMPILING;snprintf=_snprintf;CSLIM_SOURCE;%(PreprocessorDefinitions) + string.h + + + true + ws2_32.lib;%(AdditionalDependencies) + $(ProjectDir)lib\$(Configuration)\$(TargetName)$(TargetExt) + + + $(OutDir)$(TargetName)$(TargetExt) + + + + + Level3 + MaxSpeed + true + true + $(ProjectDir)include\cslim;$(ProjectDir)include\com;$(ProjectDir)include\vs2010;C:\Program Files %28x86%29\boost\boost_1_47;%(AdditionalIncludeDirectories) + _MBCS;CPP_COMPILING;snprintf=_snprintf;CSLIM_SOURCE;%(PreprocessorDefinitions) + string.h + + + true + true + true + ws2_32.lib;%(AdditionalDependencies) + $(ProjectDir)lib\$(Configuration)\$(TargetName)$(TargetExt) + + + $(OutDir)$(TargetName)$(TargetExt) + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/cslim/CSlim.vcxproj.filters b/cslim/CSlim.vcxproj.filters new file mode 100644 index 0000000..ee7e7db --- /dev/null +++ b/cslim/CSlim.vcxproj.filters @@ -0,0 +1,87 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {3d73d04f-363e-4862-8906-dad4e92c440b} + + + {0bf25f46-4775-4b84-a9d9-76a04eb8da03} + + + {663ec955-e148-4d05-bb14-53deda43c8ec} + + + {fd6f0a43-3fd4-4dc6-8ef1-c2f1fb7eb9f5} + + + + + Source Files\CSlim + + + Source Files\CSlim + + + Source Files\CSlim + + + Source Files\CSlim + + + Source Files\CSlim + + + Source Files\CSlim + + + Source Files\CSlim + + + Source Files\ComWin32 + + + Source Files\ComWin32 + + + Source Files\CSlim + + + + + Header Files\Com + + + Header Files\Com + + + Header Files\CSlim + + + Header Files\CSlim + + + Header Files\CSlim + + + Header Files\CSlim + + + Header Files\CSlim + + + Header Files\CSlim + + + \ No newline at end of file diff --git a/cslim/include/CSlim/Fixture.h b/cslim/include/CSlim/Fixture.h new file mode 100644 index 0000000..f27e7b1 --- /dev/null +++ b/cslim/include/CSlim/Fixture.h @@ -0,0 +1,94 @@ +// Fitnesse Slim plugin port for VC++ 2010 +// +// Copyright (C) 2012 Chih C. Von +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// + +#pragma once + +#include + +#include +#include +#include + +#include +#include + +// +namespace Slim +{ + class StatementExecutor; + class SlimList; + + // Fixture interface. + class FixtureIntf + { + public: + virtual ~FixtureIntf() {} + + virtual void Destroy() = 0; + virtual std::string Execute(std::string const& method, Slim::SlimList* args) = 0; + }; + + // Fixture base class serves as factory class. + template + class FixtureBase : public FixtureIntf + { + public: + static FixtureIntf* CreateInstance(Slim::StatementExecutor* executor, Slim::SlimList* args); + + virtual std::string Execute(std::string const& method, Slim::SlimList* args); + + struct FixtureMethod + { + char const* methodName; + std::string (ConcreteFixture::*funcPtr)(Slim::SlimList* args); + }; + static FixtureMethod m_lookupTable[]; + static std::string m_fixtureName; + static size_t m_methodCount; + + private: + friend ConcreteFixture; + static bool IsMatchedMethod(FixtureMethod const& fixtureMethod, std::string const& method); + }; + + template + FixtureIntf* FixtureBase::CreateInstance(Slim::StatementExecutor* executor, Slim::SlimList* args) + { + return ConcreteFixture::Create(executor, args); + } + + template + bool FixtureBase::IsMatchedMethod(FixtureMethod const& fixtureMethod, std::string const& method) + { + return boost::algorithm::iequals(method.substr(0, 32), std::string(fixtureMethod.methodName)); + } + + template + std::string FixtureBase::Execute(std::string const& method, Slim::SlimList* args) + { + // SLIM protocol only allows method name up to 32 characters. + std::string legitName = method.substr(0, 32); + auto it = std::find_if(m_lookupTable, m_lookupTable + m_methodCount, boost::bind(&FixtureBase::IsMatchedMethod, _1, legitName)); + if (it == m_lookupTable + m_methodCount) + { + throw std::exception((boost::format("%1%[%2%] %3%") % legitName % args->GetLength() % m_fixtureName).str().c_str()); + } + + return (static_cast(this)->*(it->funcPtr))(args); + } +} \ No newline at end of file diff --git a/cslim/include/CSlim/Fixtures.h b/cslim/include/CSlim/Fixtures.h new file mode 100644 index 0000000..abceb36 --- /dev/null +++ b/cslim/include/CSlim/Fixtures.h @@ -0,0 +1,52 @@ +// Fitnesse Slim plugin port for VC++ 2010 +// +// Copyright (C) 2012 Chih C. Von +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// + +#pragma once + +#define SLIM_QUOTES(x) #x +#define SLIM_FIXTURE(fixture) \ +extern void fixture##_Register(Slim::StatementExecutor*);\ +executor->AddFixture(fixture##_Register); + +#define SLIM_FIXTURES void AddFixtures(Slim::StatementExecutor* executor) \ +{ + +#define SLIM_END } + +#define SLIM_BEGIN_FIXTURE(classname) \ +typedef classname FixtureClass; \ +typedef classname##::tSuper FixtureBaseClass; \ +void classname##_Register(Slim::StatementExecutor* executor) \ +{ \ + executor->RegisterFixture(FixtureBaseClass::m_fixtureName.c_str(), FixtureBaseClass::CreateInstance); \ +} \ +std::string FixtureBaseClass::m_fixtureName = #classname; \ +FixtureClass::FixtureMethod FixtureBaseClass::m_lookupTable[] = \ +{ + +#define SLIM_FUNCTION(name) { #name, &FixtureClass::name }, + +#define SLIM_END_FIXTURE }; \ +size_t FixtureBaseClass::m_methodCount = _countof(FixtureBaseClass::m_lookupTable); + + +#define SLIM_ABORT(reason) SLIM_QUOTES(__EXCEPTION__:ABORT_SLIM_TEST:message:<>) + +#define SLIM_EXCEPTION(reason) SLIM_QUOTES(__EXCEPTION__:message:<>) + +#define SLIM_CONSTRUCTOR_ERROR(errorHandler, reason) StatementExecutor_ConstructorError(errorHandler, reason); diff --git a/cslim/include/CSlim/ListExecutor.h b/cslim/include/CSlim/ListExecutor.h new file mode 100644 index 0000000..c1f643e --- /dev/null +++ b/cslim/include/CSlim/ListExecutor.h @@ -0,0 +1,58 @@ +// Fitnesse Slim plugin port for VC++ 2010 +// +// Copyright (C) 2012 Chih C. Von +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// + +#pragma once + +#include + +#include +#include + +/////////////////////////////////////////////////////////////////////////////// +// +// ListExecutor is responsible for ... +// +/////////////////////////////////////////////////////////////////////////////// + +namespace Slim +{ + class StatementExecutor; + class SlimList; + + class ListExecutor + { + public: + ListExecutor(StatementExecutor* executor); + SlimList* Execute(SlimList* instructions); + + private: + std::string Dispatch(SlimList* instruction); + std::string InvalidCommand(SlimList* instruction); + std::string MalformedInstruction(SlimList* instruction); + std::string Import(SlimList* instruction); + std::string Make(SlimList* instruction); + std::string Call(SlimList* instruction); + std::string CallAndAssign(SlimList* instruction); + + typedef boost::function SlimCommandHandler; + typedef std::map CommandLookupTable; + CommandLookupTable m_cmdTable; + + StatementExecutor* m_executor; + }; +} \ No newline at end of file diff --git a/cslim/include/CSlim/SlimConnectionHandler.h b/cslim/include/CSlim/SlimConnectionHandler.h new file mode 100644 index 0000000..8ebf520 --- /dev/null +++ b/cslim/include/CSlim/SlimConnectionHandler.h @@ -0,0 +1,53 @@ +// Fitnesse Slim plugin port for VC++ 2010 +// +// Copyright (C) 2012 Chih C. Von +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// + +#pragma once + +#include + +#include + +/////////////////////////////////////////////////////////////////////////////// +// +// SlimConnectionHandler is responsible for ... +// +/////////////////////////////////////////////////////////////////////////////// + +namespace Slim +{ + class ConnectionHandler + { + public: + typedef boost::function ComRecvFunc; + typedef boost::function ComSendFunc; + ConnectionHandler(ComSendFunc const& sendFunction, ComRecvFunc const& recvFunction); + ~ConnectionHandler(); + + int Run(); + + typedef boost::function SlimMessageHandler; + void RegisterSlimMessageHandler(SlimMessageHandler const& handler); + + private: + int ReadSize(); + + ComSendFunc m_sendFunc; + ComRecvFunc m_recvFunc; + SlimMessageHandler m_slimHandler; + }; +} \ No newline at end of file diff --git a/cslim/include/CSlim/SlimList.h b/cslim/include/CSlim/SlimList.h new file mode 100644 index 0000000..3e144cb --- /dev/null +++ b/cslim/include/CSlim/SlimList.h @@ -0,0 +1,71 @@ +// Fitnesse Slim plugin port for VC++ 2010 +// +// Copyright (C) 2012 Chih C. Von +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// + +#pragma once + +#include +#include + +namespace Slim +{ + class SlimList; + + struct SlimListNode + { + SlimListNode() + : sublist(0) + { + } + + std::string value; + SlimList* sublist; + }; + + class SlimList + { + public: + ~SlimList(); + + void AddString(std::string value); + void AddList(SlimList* element); + int GetLength(); + bool Equals(SlimList const* other) const; + SlimList *GetListAt(int index); + std::string GetStringAt(int index); + SlimList* GetHashAt(int index); + void ReplaceAt(int index, char const * replacementString); + SlimList* GetTailAt(int index); + std::string ToString(); + + // Serialization... + static std::string Serialize(Slim::SlimList*); + static int SerializedLength(Slim::SlimList*); + + // Deserialization... + static Slim::SlimList* Deserialize(std::string const& serializedList); + + private: + SlimListNode* GetNodeAt(int index); + std::vector m_nodes; + }; + + inline bool operator==(SlimList const& rhs, SlimList const& lhs) + { + return rhs.Equals(&lhs); + } +} \ No newline at end of file diff --git a/cslim/include/CSlim/SlimMain.h b/cslim/include/CSlim/SlimMain.h new file mode 100644 index 0000000..ff46632 --- /dev/null +++ b/cslim/include/CSlim/SlimMain.h @@ -0,0 +1,21 @@ +// Fitnesse Slim plugin port for VC++ 2010 +// +// Copyright (C) 2012 Chih C. Von +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// + +#pragma once + +int RunFixtures(char* port); diff --git a/cslim/include/CSlim/StatementExecutor.h b/cslim/include/CSlim/StatementExecutor.h new file mode 100644 index 0000000..ae97a19 --- /dev/null +++ b/cslim/include/CSlim/StatementExecutor.h @@ -0,0 +1,67 @@ +// Fitnesse Slim plugin port for VC++ 2010 +// +// Copyright (C) 2012 Chih C. Von +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// + +#pragma once + +#include + +#include + +namespace Slim +{ + namespace Detail + { + class Fixtures; + class Instances; + } + + class FixtureIntf; + class SlimList; + class SymbolTable; + + class StatementExecutor; + typedef boost::function Constructor; + + class StatementExecutor + { + public: + StatementExecutor(); + ~StatementExecutor(); + + typedef boost::function AddFixtureFunc; + void AddFixture(AddFixtureFunc const& addFixture); + + void RegisterFixture(char const* className, Constructor const& constructor); + + std::string Make(char const* instanceName, char const* className, SlimList* args); + std::string Call(char const* instanceName, char const* methodName, SlimList* args); + void SetSymbol(char const* symbol, char const* value); + + void ConstructorError(char const* message); + std::string FixtureError(char const* message); + + private: + std::string message; + char const* userMessage; + + SymbolTable* symbolTable; + Detail::Fixtures* fixtures; + Detail::Instances* instances; + }; +} + diff --git a/cslim/include/CSlim/SymbolTable.h b/cslim/include/CSlim/SymbolTable.h new file mode 100644 index 0000000..f284297 --- /dev/null +++ b/cslim/include/CSlim/SymbolTable.h @@ -0,0 +1,52 @@ +// Fitnesse Slim plugin port for VC++ 2010 +// +// Copyright (C) 2012 Chih C. Von +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// + +#pragma once + +#include +#include + +/////////////////////////////////////////////////////////////////////////////// +// +// SymbolTable is responsible for ... +// +/////////////////////////////////////////////////////////////////////////////// + +namespace Slim +{ + class SlimList; + + class SymbolTable + { + public: + bool Find(std::string const& symbol) const; + bool Find(char const* symbol, int length) const; + + std::string GetValue(std::string const& symbol) const; + std::string GetValue(char const* symbol, int length) const; + + void SetValue(char const* symbol, char const* value); + + void ReplaceSymbols(SlimList* list); + + std::string ReplaceStringFrom(std::string src, std::string const& from); + + private: + std::map m_symbols; + }; +} \ No newline at end of file diff --git a/cslim/include/Com/SocketServer.h b/cslim/include/Com/SocketServer.h new file mode 100644 index 0000000..b821207 --- /dev/null +++ b/cslim/include/Com/SocketServer.h @@ -0,0 +1,55 @@ +// Fitnesse Slim plugin port for VC++ 2010 +// +// Copyright (C) 2012 Chih C. Von +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// + +#pragma once + +#include + +#include +#include + +/////////////////////////////////////////////////////////////////////////////// +// +// SocketServer is responsible for ... +// +/////////////////////////////////////////////////////////////////////////////// + +namespace Slim +{ + class SocketServer + { + public: + SocketServer(); + ~SocketServer(); + + typedef boost::function ConnectionHandler; + void RegisterHandler(ConnectionHandler const& handler); + void Run(int portToListenTo); + + private: + void StartWSA(); + void BindToSocket(); + void Shutdown(); + void CreateSocket(); + void WaitForConnection(); + + ConnectionHandler m_handler; + SOCKET m_socket; + int m_portToListenTo; + }; +} diff --git a/cslim/include/Com/TcpComLink.h b/cslim/include/Com/TcpComLink.h new file mode 100644 index 0000000..2f39edf --- /dev/null +++ b/cslim/include/Com/TcpComLink.h @@ -0,0 +1,43 @@ +// Fitnesse Slim plugin port for VC++ 2010 +// +// Copyright (C) 2012 Chih C. Von +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// + +#pragma once + +#include + +/////////////////////////////////////////////////////////////////////////////// +// +// TcpComLink is responsible for ... +// +/////////////////////////////////////////////////////////////////////////////// + +namespace Slim +{ + class TcpComLink + { + public: + TcpComLink(SOCKET socket); + ~TcpComLink(); + + int Send(char const* msg, int length); + int Receive(char* buffer, int length); + + private: + SOCKET m_socket; + }; +} \ No newline at end of file diff --git a/cslim/src/CSlim/ListExecutor.cpp b/cslim/src/CSlim/ListExecutor.cpp new file mode 100644 index 0000000..d6d7173 --- /dev/null +++ b/cslim/src/CSlim/ListExecutor.cpp @@ -0,0 +1,141 @@ +// Fitnesse Slim plugin port for VC++ 2010 +// +// Copyright (C) 2012 Chih C. Von +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// + +#include "ListExecutor.h" + +#include "SlimList.h" +#include "StatementExecutor.h" + +#include +#include +#include + +namespace +{ + void AddResult(Slim::SlimList* list, std::string const& id, char const* result) + { + Slim::SlimList* pair = new Slim::SlimList(); + pair->AddString(id); + pair->AddString(result); + list->AddList(pair); + delete pair; + } +} + +namespace Slim +{ + ListExecutor::ListExecutor(StatementExecutor* executor) + : m_executor(executor) + { + m_cmdTable["import"] = boost::bind(&ListExecutor::Import, this, _1); + m_cmdTable["make"] = boost::bind(&ListExecutor::Make, this, _1); + m_cmdTable["call"] = boost::bind(&ListExecutor::Call, this, _1); + m_cmdTable["callandassign"] = boost::bind(&ListExecutor::CallAndAssign, this, _1); + } + + SlimList* ListExecutor::Execute(SlimList* instructions) + { + SlimList* results = new SlimList(); + + int numberOfInstructions = instructions->GetLength(); + for (int n = 0; n < numberOfInstructions; ++n) + { + SlimList* instruction = instructions->GetListAt(n); + std::string id = instruction->GetStringAt(0); + std::string result = Dispatch(instruction); + AddResult(results, id, result.c_str()); + } + + return results; + } + + std::string ListExecutor::Dispatch(SlimList* instruction) + { + std::string command = instruction->GetStringAt(1); + boost::algorithm::to_lower(command); + auto it = m_cmdTable.find(command); + if (it != m_cmdTable.end()) + { + return it->second(instruction); + } + + return InvalidCommand(instruction); + } + + std::string ListExecutor::InvalidCommand(SlimList* instruction) + { + std::string id = instruction->GetStringAt(0); + std::string command = instruction->GetStringAt(1); + return (boost::format("__EXCEPTION__:message:<>") % id % command).str(); + } + + std::string ListExecutor::MalformedInstruction(SlimList* instruction) + { + return (boost::format("__EXCEPTION__:message:<>") % instruction->ToString()).str(); + } + + std::string ListExecutor::Import(SlimList* instruction) + { + return "OK"; + } + + std::string ListExecutor::Make(SlimList* instruction) + { + std::string instanceName = instruction->GetStringAt(2); + std::string className = instruction->GetStringAt(3); + SlimList* args = instruction->GetTailAt(4); + std::string result = m_executor->Make(instanceName.c_str(), className.c_str(), args); + delete args; + return result; + } + + std::string ListExecutor::Call(SlimList* instruction) + { + if (instruction->GetLength() < 4) + { + return MalformedInstruction(instruction); + } + + std::string instanceName = instruction->GetStringAt(2); + std::string methodName = instruction->GetStringAt(3); + SlimList* args = instruction->GetTailAt(4); + + std::string result = m_executor->Call(instanceName.c_str(), methodName.c_str(), args); + delete args; + return result; + } + + std::string ListExecutor::CallAndAssign(SlimList* instruction) + { + if (instruction->GetLength() < 5) + { + return MalformedInstruction(instruction); + } + + std::string symbolName = instruction->GetStringAt(2); + std::string instanceName = instruction->GetStringAt(3); + std::string methodName = instruction->GetStringAt(4); + SlimList* args = instruction->GetTailAt(5); + + std::string result = m_executor->Call(instanceName.c_str(), methodName.c_str(), args); + m_executor->SetSymbol(symbolName.c_str(), result.c_str()); + delete args; + return result; + } + +} \ No newline at end of file diff --git a/cslim/src/CSlim/RunFixtures.cpp b/cslim/src/CSlim/RunFixtures.cpp new file mode 100644 index 0000000..18c4767 --- /dev/null +++ b/cslim/src/CSlim/RunFixtures.cpp @@ -0,0 +1,72 @@ +// Fitnesse Slim plugin port for VC++ 2010 +// +// Copyright (C) 2012 Chih C. Von +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// + +#include "ListExecutor.h" +#include "SlimConnectionHandler.h" +#include "SlimList.h" +#include "SocketServer.h" +#include "StatementExecutor.h" +#include "TcpComLink.h" + +#include +#include + +#include + +extern void AddFixtures(Slim::StatementExecutor* executor); + +namespace +{ + std::string handle_slim_message(char const* message, Slim::ListExecutor& listExecutor) + { + std::unique_ptr instructions(Slim::SlimList::Deserialize(message)); + std::unique_ptr results(listExecutor.Execute(instructions.get())); + return Slim::SlimList::Serialize(results.get()); + } + + int connection_handler(SOCKET socket, Slim::ListExecutor& listExecutor) + { + std::unique_ptr comLink(new Slim::TcpComLink(socket)); + std::unique_ptr connection( + new Slim::ConnectionHandler( + boost::bind(&Slim::TcpComLink::Send, comLink.get(), _1, _2), + boost::bind(&Slim::TcpComLink::Receive, comLink.get(), _1, _2))); + + connection->RegisterSlimMessageHandler(boost::bind(&handle_slim_message, _1, listExecutor)); + return connection->Run(); + } +} + +int RunFixtures(char* port) +{ + // Setting up fixtures + Slim::StatementExecutor statementExecutor; + AddFixtures(&statementExecutor); + + Slim::ListExecutor listExecutor(&statementExecutor); + std::unique_ptr server(new Slim::SocketServer()); + server->RegisterHandler(boost::bind(&connection_handler, _1, listExecutor)); + server->Run(boost::lexical_cast(port)); + + return 0; +} + + + + + diff --git a/cslim/src/CSlim/SlimConnectionHandler.cpp b/cslim/src/CSlim/SlimConnectionHandler.cpp new file mode 100644 index 0000000..3b6386e --- /dev/null +++ b/cslim/src/CSlim/SlimConnectionHandler.cpp @@ -0,0 +1,104 @@ +// Fitnesse Slim plugin port for VC++ 2010 +// +// Copyright (C) 2012 Chih C. Von +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// + +#include "SlimConnectionHandler.h" + +#include +#include + +#include +#include + +namespace Slim +{ + ConnectionHandler::ConnectionHandler(ComSendFunc const& sendFunction, ComRecvFunc const& recvFunction) + : m_sendFunc(sendFunction) + , m_recvFunc(recvFunction) + , m_slimHandler(0) + { + } + + ConnectionHandler::~ConnectionHandler() + { + } + + void ConnectionHandler::RegisterSlimMessageHandler(SlimMessageHandler const& handler) + { + m_slimHandler = handler; + } + + int ConnectionHandler::ReadSize() + { + char size[7]; + memset(size, 0, 7); + int size_i = -1; + if (m_recvFunc(size, 6) == 6) + { + char colon; + if ((m_recvFunc(&colon, 1)) == 1 && colon == ':') + { + size_i = boost::lexical_cast(size); + } + } + return size_i; + } + + + int ConnectionHandler::Run() + { + assert(m_slimHandler); + + if (m_sendFunc("Slim -- V0.0\n", 13) == -1) + { + return -1; + } + + while (true) + { + int size_i = ReadSize(); + if (size_i > 0) + { + std::string message(size_i, 0); + int numbytes = m_recvFunc(&message[0], size_i); + if (numbytes != size_i) + { + printf("did not receive right number of bytes. %d expected but received %d\n", size_i, numbytes); + break; + } + + if (message == "bye") + { + break; + } + + // execute and get response + std::string response_message = m_slimHandler(message.c_str()); + int response_length = response_message.size(); + int send_result = m_sendFunc((boost::format("%1$06d:%2%") % response_length % response_message).str().c_str(), response_length + 7); + if (send_result != (response_length + 7)) + { + printf("Failure to send all data"); + break; + } + } + } + + fflush(stdout); + return 0; + } +} \ No newline at end of file diff --git a/cslim/src/CSlim/SlimList.cpp b/cslim/src/CSlim/SlimList.cpp new file mode 100644 index 0000000..ba7fbde --- /dev/null +++ b/cslim/src/CSlim/SlimList.cpp @@ -0,0 +1,193 @@ +// Fitnesse Slim plugin port for VC++ 2010 +// +// Copyright (C) 2012 Chih C. Von +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// + +#include "SlimList.h" + +#include +#include + +namespace +{ + std::string const hashRowOpenTag = ""; + std::string const hashRowCloseTag = ""; + std::string const hashCellOpenTag = ""; + std::string const hashCellCloseTag = ""; + + std::string parseHashCell(char const*& cellStart) + { + char const* cellValue = cellStart + hashCellOpenTag.size(); + char const* cellStop = strstr(cellValue, hashCellCloseTag.c_str()); + std::string buf(cellValue, cellStop - cellValue); + cellStart = strstr(cellStop + hashCellOpenTag.size(), hashCellOpenTag.c_str()); + return buf; + } + + Slim::SlimList* parseHashEntry(char const* row) + { + Slim::SlimList* element = new Slim::SlimList(); + + char const* cellStart = strstr(row, hashCellOpenTag.c_str()); + std::string hashKey = parseHashCell(cellStart); + element->AddString(hashKey); + + std::string hashValue = parseHashCell(cellStart); + element->AddString(hashValue); + + return element; + } +} + +namespace Slim +{ + SlimList::~SlimList() + { + boost::for_each(m_nodes, + [](SlimListNode const& node) + { + delete node.sublist; + }); + } + + void SlimList::AddString(std::string value) + { + SlimListNode newNode; + newNode.value = value; + m_nodes.push_back(newNode); + } + + void SlimList::AddList(SlimList* element) + { + AddString(Serialize(element)); + } + + int SlimList::GetLength() + { + return m_nodes.size(); + } + + bool SlimList::Equals(SlimList const* other) const + { + return boost::equals(m_nodes, other->m_nodes, + [](SlimListNode const& lhs, SlimListNode const& rhs)->bool + { + return lhs.value == rhs.value; + }); + } + + SlimList* SlimList::GetListAt(int index) + { + SlimListNode* node = GetNodeAt(index); + if (!node) + { + return 0; + } + + if (!node->sublist) + { + node->sublist = Deserialize(node->value); + } + return node->sublist; + } + + std::string SlimList::GetStringAt(int index) + { + SlimListNode* node = GetNodeAt(index); + if (!node) + { + return std::string(); + } + + return node->value; + } + + SlimList* SlimList::GetHashAt(int index) + { + SlimList* hash = new SlimList(); + SlimList* element = 0; + + std::string value = GetStringAt(0); + char const* row = strstr(value.c_str(), hashRowOpenTag.c_str()); + while (row != NULL) + { + element = parseHashEntry(row); + hash->AddList(element); + delete element; + row = strstr(row + hashRowOpenTag.size(), hashRowOpenTag.c_str()); + } + + return hash; + } + + SlimListNode* SlimList::GetNodeAt(int index) + { + if (index >= GetLength()) + { + return 0; + } + + return &m_nodes[index]; + } + + void SlimList::ReplaceAt(int index, char const* replacementString) + { + SlimListNode* node = GetNodeAt(index); + node->value = replacementString; + if (node->sublist) + { + delete node->sublist; + node->sublist = 0; + } + } + + SlimList* SlimList::GetTailAt(int index) + { + SlimList* tail = new SlimList(); + for(int length = GetLength(); index < length; ++index) + { + tail->AddString(GetStringAt(index).c_str()); + } + return tail; + } + + std::string SlimList::ToString() + { + std::string buf("["); + for (int i = 0; i < GetLength(); ++i) + { + SlimList* sublist = GetListAt(i); + if (sublist) + { + buf += sublist->ToString(); + } + else + { + buf += '"'; + buf += GetStringAt(i); + buf += '"'; + } + + if (i != (GetLength() - 1)) + { + buf += ", "; + } + } + + buf += ']'; + return buf; + } +} \ No newline at end of file diff --git a/cslim/src/CSlim/SlimListDeserializer.cpp b/cslim/src/CSlim/SlimListDeserializer.cpp new file mode 100644 index 0000000..7b0b86a --- /dev/null +++ b/cslim/src/CSlim/SlimListDeserializer.cpp @@ -0,0 +1,98 @@ +// Fitnesse Slim plugin port for VC++ 2010 +// +// Copyright (C) 2012 Chih C. Von +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// + +#include "SlimList.h" + +#include + +#include + +namespace +{ + inline bool Skip(std::istringstream& is, char const c) + { + char ic; + is >> ic; + return ic == c; + } + + int readLength(std::istringstream& is) + { + std::string length(6, 0); + is.read(&length[0], 6); + return boost::lexical_cast(length); + } +} + +namespace Slim +{ + SlimList* SlimList::Deserialize(std::string const& serializedList) + { + if (serializedList.empty()) + { + return 0; + } + + std::istringstream is(serializedList); + is.exceptions(std::ios_base::eofbit|std::ios_base::failbit|std::ios_base::badbit); + std::unique_ptr list(new SlimList()); + + try + { + if (!Skip(is, '[')) + { + return nullptr; + } + + int listLength = readLength(is); + if (!Skip(is, ':')) + { + return nullptr; + } + + while (listLength--) + { + int elementLength = readLength(is); + if (!Skip(is, ':')) + { + return nullptr; + } + + std::string value(elementLength, 0); + is.read(&value[0], elementLength); + list->AddString(value); + + if (!Skip(is, ':')) + { + return nullptr; + } + } + + if (!Skip(is, ']')) + { + return nullptr; + } + + return list.release(); + } + catch (std::ios_base::failure const&) + { + return nullptr; + } + } +} diff --git a/cslim/src/CSlim/SlimListSerializer.cpp b/cslim/src/CSlim/SlimListSerializer.cpp new file mode 100644 index 0000000..46e1ed5 --- /dev/null +++ b/cslim/src/CSlim/SlimListSerializer.cpp @@ -0,0 +1,71 @@ +// Fitnesse Slim plugin port for VC++ 2010 +// +// Copyright (C) 2012 Chih C. Von +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// + +#include "SlimList.h" + +#include + +#include + +namespace +{ + int const ListOverhead = 9; + int const ElementOverhead = 8; + + std::string nodeStringAt(Slim::SlimList* self, int i) + { + std::string nodeString = self->GetStringAt(i); + if (nodeString.empty()) + { + nodeString = "null"; + } + + return nodeString; + } +} + +namespace Slim +{ + int SlimList::SerializedLength(SlimList* self) + { + int length = ListOverhead; + for (int i = 0; i < self->GetLength(); ++i) + { + length += nodeStringAt(self, i).size() + ElementOverhead; + } + return length; + } + + std::string SlimList::Serialize(SlimList* self) + { + std::ostringstream buf; + + int listLength = self->GetLength(); + buf << (boost::format("[%06d:") % listLength).str(); + + for (int i = 0; i < listLength; ++i) + { + std::string nodeString = nodeStringAt(self, i); + buf << (boost::format("%1$06ld:%2%:") % nodeString.size() % nodeString).str(); + } + + buf << "]"; + return buf.str(); + } +} + diff --git a/cslim/src/CSlim/StatementExecutor.cpp b/cslim/src/CSlim/StatementExecutor.cpp new file mode 100644 index 0000000..504c684 --- /dev/null +++ b/cslim/src/CSlim/StatementExecutor.cpp @@ -0,0 +1,191 @@ +// Fitnesse Slim plugin port for VC++ 2010 +// +// Copyright (C) 2012 Chih C. Von +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// + +#include "StatementExecutor.h" + +#include "Fixture.h" +#include "SymbolTable.h" +#include "SlimList.h" + +#include + +#include +#include +#include + +namespace Slim +{ + namespace Detail + { + // + class Fixtures + { + public: + void Register(char const* className, Slim::Constructor const& constructor); + Slim::Constructor const* GetConstructor(char const* className) const; + + private: + std::map m_fixtures; + }; + + inline void Fixtures::Register(char const* className, Slim::Constructor const& constructor) + { + m_fixtures[className] = constructor; + } + + inline Slim::Constructor const* Fixtures::GetConstructor(char const* className) const + { + auto it = m_fixtures.find(className); + return it != m_fixtures.end() ? &(it->second) : 0; + } + + // + class Instances + { + public: + ~Instances(); + + void SetInstance(char const* instanceName, Slim::FixtureIntf* instance); + Slim::FixtureIntf* GetInstance(char const* instanceName) const; + void RemoveInstance(char const* instanceName); + + private: + std::map m_instances; + }; + + Instances::~Instances() + { + std::for_each(m_instances.begin(), m_instances.end(), + [](std::pair const& instance) + { + instance.second->Destroy(); + }); + } + + inline void Instances::SetInstance(char const* instanceName, Slim::FixtureIntf* instance) + { + assert(instance); + if (m_instances[instanceName]) + { + m_instances[instanceName]->Destroy(); + } + m_instances[instanceName] = instance; + } + + inline Slim::FixtureIntf* Instances::GetInstance(char const* instanceName) const + { + auto it = m_instances.find(instanceName); + return it != m_instances.end() ? it->second : 0; + } + + inline void Instances::RemoveInstance(char const* instanceName) + { + m_instances.erase(instanceName); + } + } + + + // + StatementExecutor::StatementExecutor() + : symbolTable(new SymbolTable()) + , fixtures(new Detail::Fixtures()) + , instances(new Detail::Instances()) + { + } + + StatementExecutor::~StatementExecutor() + { + delete symbolTable; + delete fixtures; + delete instances; + } + + std::string StatementExecutor::Make(char const* instanceName, char const* className, SlimList* args) + { + Constructor const* fixtureConstructor = fixtures->GetConstructor(className); + if (!fixtureConstructor) + { + instances->RemoveInstance(instanceName); + return (boost::format("__EXCEPTION__:message:<>") % className).str(); + } + + symbolTable->ReplaceSymbols(args); + FixtureIntf* instance = (*fixtureConstructor)(this, args); + if (!instance) + { + return (boost::format("__EXCEPTION__:message:<>") % className % (userMessage ? userMessage : "")).str(); + } + + instances->SetInstance(instanceName, instance); + userMessage = NULL; + return "OK"; + } + + std::string StatementExecutor::Call(char const* instanceName, char const* methodName, SlimList* args) + { + FixtureIntf* instance = instances->GetInstance(instanceName); + if (!instance) + { + return (boost::format("__EXCEPTION__:message:<>") % instanceName).str(); + } + + try + { + symbolTable->ReplaceSymbols(args); + return instance->Execute(methodName, args); + } + catch (std::exception const& e) + { + return (boost::format("__EXCEPTION__:message:<>") % e.what()).str(); + } + } + + void StatementExecutor::AddFixture(AddFixtureFunc const& addFixture) + { + addFixture(this); + } + + void StatementExecutor::RegisterFixture(char const* className, Constructor const& constructor) + { + fixtures->Register(className, constructor); + } + + void StatementExecutor::SetSymbol(char const* symbol, char const* value) + { + symbolTable->SetValue(symbol, value); + } + + void StatementExecutor::ConstructorError(char const* message) + { + userMessage = message; + } + + std::string StatementExecutor::FixtureError(char const* message) + { + return (boost::format("__EXCEPTION__:message:<<%1%.>>") % message).str(); + } + + static void* Null_Create(StatementExecutor* executor, SlimList* args) + { + return NULL; + } + + static void Null_Destroy(void* self) + { + } +} diff --git a/cslim/src/CSlim/SymbolTable.cpp b/cslim/src/CSlim/SymbolTable.cpp new file mode 100644 index 0000000..e06d3f9 --- /dev/null +++ b/cslim/src/CSlim/SymbolTable.cpp @@ -0,0 +1,126 @@ +// Fitnesse Slim plugin port for VC++ 2010 +// +// Copyright (C) 2012 Chih C. Von +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// + +#include "SymbolTable.h" + +#include "SlimList.h" + +#include + +namespace +{ + int lengthOfSymbol(char const* start) + { + int length = 0; + while(isalnum(*start)) + { + start++; + length ++; + } + return length; + } +} + +namespace Slim +{ + bool SymbolTable::Find(std::string const& symbol) const + { + return m_symbols.find(symbol) != m_symbols.end(); + } + + bool SymbolTable::Find(char const* symbol, int length) const + { + return Find(std::string(symbol, length)); + } + + std::string SymbolTable::GetValue(std::string const& symbol) const + { + auto it = m_symbols.find(symbol); + if (it == m_symbols.end()) + { + throw std::exception("Can't find symbol in symbol table."); + } + + return it->second; + } + + std::string SymbolTable::GetValue(char const* symbol, int length) const + { + return GetValue(std::string(symbol, length)); + } + + // This function will create a new entry if symbol doesn't exist yet. + void SymbolTable::SetValue(char const* symbol, char const* value) + { + m_symbols[symbol] = value; + } + + void SymbolTable::ReplaceSymbols(SlimList* list) + { + for (int i = 0; i < list->GetLength(); ++i) + { + std::string src = list->GetStringAt(i); + std::unique_ptr embeddedList(SlimList::Deserialize(src)); + if (!embeddedList) + { + std::string replacedString = ReplaceStringFrom(src, src); + list->ReplaceAt(i, replacedString.c_str()); + } + else + { + ReplaceSymbols(embeddedList.get()); + std::string serializedReplacedList = SlimList::Serialize(embeddedList.get()); + list->ReplaceAt(i, serializedReplacedList.c_str()); + } + } + } + + std::string SymbolTable::ReplaceStringFrom(std::string src, std::string const& from) + { + size_t pos = from.find('$'); + if (std::string::npos == pos) + { + return src; + } + + char const* dollarSign = from.c_str() + pos; + int length = lengthOfSymbol(dollarSign + 1); + std::string symbol(dollarSign, length + 1); + try + { + std::string symbolValue = GetValue(dollarSign + 1, length); + boost::algorithm::replace_all(src + , symbol + , symbolValue); + return ReplaceStringFrom(src, src); + } + catch (std::exception const&) + { + // eat exception. + } + + // We are running out of data. + if (from.size() == (pos + 1)) + { + return src; + } + + return ReplaceStringFrom(src, dollarSign + 1); + } + +} \ No newline at end of file diff --git a/cslim/src/ComWin32/SocketServer.cpp b/cslim/src/ComWin32/SocketServer.cpp new file mode 100644 index 0000000..2950ab1 --- /dev/null +++ b/cslim/src/ComWin32/SocketServer.cpp @@ -0,0 +1,102 @@ +// Fitnesse Slim plugin port for VC++ 2010 +// +// Copyright (C) 2012 Chih C. Von +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// + +#include "SocketServer.h" + +namespace Slim +{ + SocketServer::SocketServer() + : m_handler(0) + , m_socket() + , m_portToListenTo(-1) + { + } + + SocketServer::~SocketServer() + { + Shutdown(); + } + + void SocketServer::RegisterHandler(ConnectionHandler const& handler) + { + m_handler = handler; + } + + void SocketServer::Run(int portToListenTo) + { + m_portToListenTo = portToListenTo; + + StartWSA(); + CreateSocket(); + BindToSocket(); + WaitForConnection(); + Shutdown(); + } + + void SocketServer::StartWSA() + { + WSADATA WsaDat; + if (!WSAStartup(MAKEWORD(2,2), &WsaDat)) + { + printf("WSA Initialization failed!"); + } + } + + void SocketServer::BindToSocket() + { + SOCKADDR_IN serverInf; + serverInf.sin_family = AF_INET; + serverInf.sin_addr.s_addr = INADDR_ANY; + serverInf.sin_port = htons(m_portToListenTo); + + if (bind(m_socket, (SOCKADDR*)(&serverInf), sizeof(serverInf)) == SOCKET_ERROR) + { + printf("Unable to bind socket!"); + } + } + + void SocketServer::Shutdown() + { + shutdown(m_socket, SD_SEND); + closesocket(m_socket); + WSACleanup(); + } + + void SocketServer::CreateSocket() + { + m_socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); + if (m_socket == INVALID_SOCKET) + { + printf("Socket creation failed."); + } + } + + void SocketServer::WaitForConnection() + { + listen(m_socket, 1); + + SOCKET TempSock = SOCKET_ERROR; + while(TempSock == SOCKET_ERROR) + { + TempSock = accept(m_socket, NULL, NULL); + } + + m_handler(TempSock); + closesocket(TempSock); + } +} \ No newline at end of file diff --git a/cslim/src/ComWin32/TcpComLink.cpp b/cslim/src/ComWin32/TcpComLink.cpp new file mode 100644 index 0000000..462d8e5 --- /dev/null +++ b/cslim/src/ComWin32/TcpComLink.cpp @@ -0,0 +1,64 @@ +// Fitnesse Slim plugin port for VC++ 2010 +// +// Copyright (C) 2012 Chih C. Von +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// + +#include "TcpComLink.h" + +namespace Slim +{ + TcpComLink::TcpComLink(SOCKET socket) + : m_socket(socket) + { + } + + TcpComLink::~TcpComLink() + { + } + + int TcpComLink::Send(char const* msg, int length) + { + int total = 0; // how many bytes we've sent + int bytesleft = length; // how many we have left to send + int n; + + while (total < length) + { + n = send(m_socket, msg+total, bytesleft, 0); + if (n == -1) + { + break; + } + + total += n; + bytesleft -= n; + } + + return total; + } + + int TcpComLink::Receive(char * buffer, int length) + { + //No MSG_WAITALL flag in winsock2 ???? + int bytesReceived = 0; + while (bytesReceived < length) + { + bytesReceived += recv(m_socket, buffer + bytesReceived, length - bytesReceived, 0); + } + + return bytesReceived; + } +} \ No newline at end of file diff --git a/fixtures/DecisionTableExample.c b/fixtures/DecisionTableExample.c deleted file mode 100644 index a5427f9..0000000 --- a/fixtures/DecisionTableExample.c +++ /dev/null @@ -1,72 +0,0 @@ -#include -#include -#include -#include "SlimList.h" -#include "Fixtures.h" - -typedef struct Division -{ - float numerator; - float denominator; - char result[32]; -} Division; - -void* Division_Create(StatementExecutor* errorHandler, SlimList* args) -{ - Division* self = (Division*)malloc(sizeof(Division)); - memset(self, 0, sizeof(Division)); - return self; -} - -void Division_Destroy(void* void_self) -{ - free(void_self); -} - -static char* setNumerator(void* void_self, SlimList* args) { - Division* self = (Division*)void_self; - self->numerator = atof(SlimList_GetStringAt(args, 0)); - return ""; -} - -static char* setDenominator(void* void_self, SlimList* args) { - Division* self = (Division*)void_self; - self->denominator = atof(SlimList_GetStringAt(args, 0)); - if (self->denominator == 0.0) - return SLIM_EXCEPTION("You shouldn't divide by zero now should ya?"); - return ""; -} - -static char* Quotient(void* void_self, SlimList* args) { - Division* self = (Division*)void_self; - float quotient = self->numerator / self->denominator; - snprintf(self->result, 32, "%g", quotient); - return self->result; -} - -//These are optional. If they aren't declared, they are ignored -static char* execute(void* void_self, SlimList* args) { - return ""; -} - -static char* reset(void* void_self, SlimList* args) { - Division* self = (Division*)void_self; - self->denominator = 0.0f; - self->numerator = 0.0f; - return ""; -} -static char* table(void* void_self, SlimList* args) { - return ""; -} - - - -SLIM_CREATE_FIXTURE(Division) - SLIM_FUNCTION(setNumerator) - SLIM_FUNCTION(setDenominator) - SLIM_FUNCTION(Quotient) - SLIM_FUNCTION(execute) - SLIM_FUNCTION(reset) - SLIM_FUNCTION(table) -SLIM_END - diff --git a/fixtures/ExceptionsExample.c b/fixtures/ExceptionsExample.c deleted file mode 100644 index eaa8096..0000000 --- a/fixtures/ExceptionsExample.c +++ /dev/null @@ -1,35 +0,0 @@ -#include -#include -#include -#include "SlimList.h" -#include "Fixtures.h" - -typedef struct ExceptionsExample -{ -} ExceptionsExample; - -void* ExceptionsExample_Create(StatementExecutor* errorHandler, SlimList* args) -{ - if (SlimList_GetLength(args) < 1) { - SLIM_CONSTRUCTOR_ERROR(errorHandler, "One arg required"); - return NULL; - } - - ExceptionsExample* self = (ExceptionsExample*)malloc(sizeof(ExceptionsExample)); - memset(self, 0, sizeof(ExceptionsExample)); - return self; -} - -void ExceptionsExample_Destroy(void* void_self) -{ - free(void_self); -} - -static char* setTrouble(void* void_self, SlimList* args) { - return SLIM_EXCEPTION("You stink"); -} - -SLIM_CREATE_FIXTURE(ExceptionsExample) - SLIM_FUNCTION(setTrouble) -SLIM_END - diff --git a/fixtures/FixtureInCpp.cpp b/fixtures/FixtureInCpp.cpp deleted file mode 100644 index 16c78b7..0000000 --- a/fixtures/FixtureInCpp.cpp +++ /dev/null @@ -1,73 +0,0 @@ -#include -#include -#include -#include "SlimList.h" -#include "Fixtures.h" - -class cMultiplication -{ -public: - cMultiplication(){}; - ~cMultiplication(){}; - float product() - { - return m1*m2; - } - float m1; - float m2; - char result[32]; -}; - -#ifndef CPP_COMPILING -extern "C" { -#endif -typedef struct Multiplication -{ - cMultiplication multiplication; - char result[32]; -} Multiplication; - -void* Multiplication_Create(StatementExecutor* errorHandler, SlimList* args) -{ - Multiplication* self = (Multiplication*)malloc(sizeof(Multiplication)); - self->result[0] = 0; - // self->multiplication = new cMultiplication(); - return self; -} - -void Multiplication_Destroy(void* void_self) -{ - Multiplication* self = (Multiplication*)void_self; - // delete self->multiplication; - free(self); -} - -static char* setMultiplicand1(void* void_self, SlimList* args) { - Multiplication* self = (Multiplication*)void_self; - self->multiplication.m1 = atof(SlimList_GetStringAt(args, 0)); - return self->result; -} - -static char* setMultiplicand2(void* void_self, SlimList* args) { - Multiplication* self = (Multiplication*)void_self; - self->multiplication.m2 = atof(SlimList_GetStringAt(args, 0)); - return self->result; -} - -static char* Product(void* void_self, SlimList* args) { - Multiplication* self = (Multiplication*)void_self; - float product = self->multiplication.product(); - snprintf(self->result, 32, "%g", product); - return self->result; -} - - -SLIM_CREATE_FIXTURE(Multiplication) - SLIM_FUNCTION(setMultiplicand1) - SLIM_FUNCTION(setMultiplicand2) - SLIM_FUNCTION(Product) -SLIM_END - -#ifndef CPP_COMPILING -} -#endif diff --git a/fixtures/Main.c b/fixtures/Main.c deleted file mode 100644 index 2b80506..0000000 --- a/fixtures/Main.c +++ /dev/null @@ -1,34 +0,0 @@ -#include "Slim.h" -#include "SocketServer.h" -#include "SlimConnectionHandler.h" -#include "TcpComLink.h" -#include -#include - -Slim * slim; - -int connection_handler(int socket) -{ - int result = 0; - TcpComLink * comLink = TcpComLink_Create(socket); - - result = Slim_HandleConnection(slim, (void*)comLink, &TcpComLink_send, &TcpComLink_recv); - - TcpComLink_Destroy(comLink); - - return result; -} - -int main(int ac, char** av) -{ - slim = Slim_Create(); - SocketServer* server = SocketServer_Create(); - SocketServer_register_handler(server, &connection_handler); - - int result = SocketServer_Run(server, av[1]); - - SocketServer_Destroy(server); - Slim_Destroy(slim); - return result; -} - diff --git a/fixtures/QueryTableExample.c b/fixtures/QueryTableExample.c deleted file mode 100644 index 46e4d52..0000000 --- a/fixtures/QueryTableExample.c +++ /dev/null @@ -1,59 +0,0 @@ -#include -#include -#include -#include "Fixtures.h" -#include "SlimList.h" -#include "SlimListSerializer.h" - - -typedef struct EmployeePayRecordsRow -{ - char * result; -} EmployeePayRecordsRow; - -void* EmployeePayRecordsRow_Create(StatementExecutor* errorHandler, SlimList* args) -{ - EmployeePayRecordsRow* self = (EmployeePayRecordsRow*)malloc(sizeof(EmployeePayRecordsRow)); - memset(self, 0, sizeof(EmployeePayRecordsRow)); - return self; -} - -void EmployeePayRecordsRow_Destroy(void* void_self) -{ - EmployeePayRecordsRow* self = (EmployeePayRecordsRow*)void_self; - SlimList_Release(self->result); - free(self); -} - -static char* query(void* void_self, SlimList* args) { - EmployeePayRecordsRow* self = (EmployeePayRecordsRow*)void_self; - - SlimList* id = SlimList_Create(); - SlimList_AddString(id, "id"); - SlimList_AddString(id, "1"); - - SlimList* pay = SlimList_Create(); - SlimList_AddString(pay, "pay"); - SlimList_AddString(pay, "1000"); - - SlimList* record1 = SlimList_Create(); - SlimList_AddList(record1, id); - SlimList_AddList(record1, pay); - - SlimList* records = SlimList_Create(); - SlimList_AddList(records, record1); - - SlimList_Release(self->result); - self->result = SlimList_Serialize(records); - - SlimList_Destroy(id); - SlimList_Destroy(pay); - SlimList_Destroy(record1); - SlimList_Destroy(records); - return self->result; -} - -SLIM_CREATE_FIXTURE(EmployeePayRecordsRow) - SLIM_FUNCTION(query) -SLIM_END - diff --git a/fixtures/ScriptTableExample.c b/fixtures/ScriptTableExample.c deleted file mode 100644 index 5d8ad9e..0000000 --- a/fixtures/ScriptTableExample.c +++ /dev/null @@ -1,43 +0,0 @@ -#include -#include -#include - -#include "Fixtures.h" -#include "SlimList.h" - -typedef struct Count -{ - int count; - char result[32]; -} Count; - -void* Count_Create(StatementExecutor* errorHandler, SlimList* args) -{ - Count* self = (Count*)malloc(sizeof(Count)); - memset(self, 0, sizeof(Count)); - return self; -} - -void Count_Destroy(void* self) -{ - free(self); -} - -static char* count(void* void_self, SlimList* args) { - Count* self = (Count*)void_self; - self->count++; - return ""; -} - -static char* counter(void* void_self, SlimList* args) { - Count* self = (Count*)void_self; - snprintf(self->result, 32, "%d", self->count); - return self->result; -} - - -SLIM_CREATE_FIXTURE(Count) - SLIM_FUNCTION(count) - SLIM_FUNCTION(counter) -SLIM_END - diff --git a/fixtures/pages/CounterTest/content.txt b/fixtures/pages/CounterTest/content.txt deleted file mode 100644 index bb838d4..0000000 --- a/fixtures/pages/CounterTest/content.txt +++ /dev/null @@ -1,10 +0,0 @@ -!|script|Count| -|count| -|count| -|check|counter|2| -|count| -|count| -|check|counter|4| -|count| -|count| -|check|counter|6| diff --git a/fixtures/pages/DivisionTest/content.txt b/fixtures/pages/DivisionTest/content.txt deleted file mode 100644 index 08aa918..0000000 --- a/fixtures/pages/DivisionTest/content.txt +++ /dev/null @@ -1,150 +0,0 @@ -!|Division| -|numerator|denominator|Quotient?| -|10|5|2| -{{{ -|55|11|5| -|1|1|1| -|10|5|2| -|55|11|5| -|1|1|1| -|10|5|2| -|55|11|5| -|1|1|1| -|10|5|2| -|55|11|5| -|1|1|1| -|10|5|2| -|55|11|5| -|1|1|1| -|10|5|2| -|55|11|5| -|1|1|1| -|10|5|2| -|55|11|5| -|1|1|1| -|10|5|2| -|55|11|5| -|1|1|1| -|10|5|2| -|55|11|5| -|1|1|1| -|10|5|2| -|55|11|5| -|1|1|1| -|10|5|2| -|55|11|5| -|1|1|1| -|10|5|2| -|55|11|5| -|1|1|1| -|10|5|2| -|55|11|5| -|1|1|1| -|10|5|2| -|55|11|5| -|1|1|1| -|10|5|2| -|55|11|5| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -|1|1|1| -}}} \ No newline at end of file diff --git a/fixtures/pages/content.txt b/fixtures/pages/content.txt deleted file mode 100644 index 99c097c..0000000 --- a/fixtures/pages/content.txt +++ /dev/null @@ -1 +0,0 @@ -!contents -R2 -g -p -f -h diff --git a/include/CSlim/Fixtures.h b/include/CSlim/Fixtures.h deleted file mode 100644 index 2df1b2e..0000000 --- a/include/CSlim/Fixtures.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef CPP_COMPILING -#ifdef __cplusplus -extern "C" { -#endif -#endif - -#include "StatementExecutor.h" - -#define SLIM_QUOTES(x) #x -#define SLIM_FIXTURE(fixture) \ -extern void fixture##_Register(StatementExecutor*);\ -StatementExecutor_AddFixture(executor, fixture##_Register); - -#define SLIM_FIXTURES void AddFixtures(StatementExecutor* executor) \ -{ - -#define SLIM_END } - -#define PRIVATE_REGISTER_FIXTURE(name) StatementExecutor_RegisterFixture(executor, #name, name##_Create, name##_Destroy); - -#define SLIM_CREATE_EMPTY_FIXTURE(name) \ - void name##_Register(StatementExecutor* executor) \ - { \ - PRIVATE_REGISTER_FIXTURE(name)\ - } - - -#define SLIM_CREATE_FIXTURE(name) static const char * fixtureName = #name; \ -void name##_Register(StatementExecutor* executor) \ -{ \ - PRIVATE_REGISTER_FIXTURE(name); - -#define SLIM_FUNCTION(name) StatementExecutor_RegisterMethod(executor, fixtureName, #name, name); - - -#define SLIM_ABORT(reason) SLIM_QUOTES(__EXCEPTION__:ABORT_SLIM_TEST:message:<>) - -#define SLIM_EXCEPTION(reason) SLIM_QUOTES(__EXCEPTION__:message:<>) - -#define SLIM_CONSTRUCTOR_ERROR(errorHandler, reason) StatementExecutor_ConstructorError(errorHandler, reason); - - -#ifndef CPP_COMPILING -#ifdef __cplusplus -} -#endif -#endif diff --git a/include/CSlim/ListExecutor.h b/include/CSlim/ListExecutor.h deleted file mode 100644 index cbceca3..0000000 --- a/include/CSlim/ListExecutor.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef D_ListExecutor_H -#define D_ListExecutor_H - -#include "SlimList.h" -#include "StatementExecutor.h" -typedef struct ListExecutor ListExecutor; - -ListExecutor* ListExecutor_Create(StatementExecutor*); -void ListExecutor_Destroy(ListExecutor*); -SlimList* ListExecutor_Execute(ListExecutor*, SlimList*); - -#endif diff --git a/include/CSlim/Slim.h b/include/CSlim/Slim.h deleted file mode 100644 index 55db8ed..0000000 --- a/include/CSlim/Slim.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef D_Slim_H -#define D_Slim_H -#include "SlimConnectionHandler.h" - -typedef struct Slim Slim; - -Slim * Slim_Create(); -void Slim_Destroy(Slim*); -char * Slim_HandleMessage(void* self, char * message); -int Slim_HandleConnection(Slim* self, void* comLink, com_func_t send, com_func_t recv); -#endif diff --git a/include/CSlim/SlimConnectionHandler.h b/include/CSlim/SlimConnectionHandler.h deleted file mode 100644 index 91e3ec8..0000000 --- a/include/CSlim/SlimConnectionHandler.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef D_SlimConnectionHandler_H -#define D_SlimConnectionHandler_H - -typedef struct SlimConnectionHandler SlimConnectionHandler; - -typedef int(*com_func_t)(void * handle, char * msg, int length); -typedef char * (*handler_func_t)(void *, char *); - -SlimConnectionHandler* SlimConnectionHandler_Create(com_func_t sendFunction, com_func_t recvFunction, void * comLink); -void SlimConnectionHandler_Destroy(SlimConnectionHandler*); -int SlimConnectionHandler_Run(SlimConnectionHandler*); -void SlimConnectionHandler_RegisterSlimMessageHandler(SlimConnectionHandler*, void* handler, handler_func_t ); - -#endif diff --git a/include/CSlim/SlimList.h b/include/CSlim/SlimList.h deleted file mode 100644 index 467b8a0..0000000 --- a/include/CSlim/SlimList.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef D_SlimList_H -#define D_SlimList_H - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct SlimList SlimList; - -SlimList* SlimList_Create(void); -void SlimList_Destroy(SlimList*); -extern void SlimList_AddString(SlimList*, char const *); -void SlimList_AddList(SlimList* self, SlimList* element); -int SlimList_GetLength(SlimList*); -int SlimList_Equals(SlimList* self, SlimList* other); -SlimList * SlimList_GetListAt(SlimList* self, int index); -char * SlimList_GetStringAt(SlimList* self, int index); -double SlimList_GetDoubleAt(SlimList* self, int index); -SlimList* SlimList_GetHashAt(SlimList* self, int index); -void SlimList_ReplaceAt(SlimList* self, int index, char const * replacementString); -void SlimList_AddBuffer(SlimList* self, char const* buffer, int length); -SlimList* SlimList_GetTailAt(SlimList*, int index); -char* SlimList_ToString(SlimList*); -#ifdef __cplusplus -} -#endif - - -#endif diff --git a/include/CSlim/SlimListDeserializer.h b/include/CSlim/SlimListDeserializer.h deleted file mode 100644 index e0b4423..0000000 --- a/include/CSlim/SlimListDeserializer.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef SlimList_Deserialize_H -#define SlimList_Deserialize_H - -SlimList* SlimList_Deserialize(char const *); - -#endif diff --git a/include/CSlim/SlimListSerializer.h b/include/CSlim/SlimListSerializer.h deleted file mode 100644 index aa871b6..0000000 --- a/include/CSlim/SlimListSerializer.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef SlimListSerializer_H -#define SlimListSerializer_H -#include "SlimList.h" - -char* SlimList_Serialize(SlimList*); -void SlimList_Release(char *serializedResults); -int SlimList_SerializedLength(SlimList*); - -#endif diff --git a/include/CSlim/SlimUtil.h b/include/CSlim/SlimUtil.h deleted file mode 100644 index 1e3f1f9..0000000 --- a/include/CSlim/SlimUtil.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef SLIMUTILS_H -#define SLIMUTILS_H -char * CSlim_BuyBuf(char const*, int); -char * CSlim_BuyString(char const*); - -typedef struct MapStringInt -{ - const char* string; - int n; -} MapStringInt; - -int CSlim_MapToIntFrom(MapStringInt*, const char*); -const char* CSlim_MapToStringFrom(MapStringInt*, int); -#endif diff --git a/include/CSlim/StatementExecutor.h b/include/CSlim/StatementExecutor.h deleted file mode 100644 index 6ebe68d..0000000 --- a/include/CSlim/StatementExecutor.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef D_StatementExecutor_H -#define D_StatementExecutor_H - -#include "SlimList.h" - -typedef struct StatementExecutor StatementExecutor; -typedef void(*Fixture)(StatementExecutor*); -typedef void*(*Constructor)(StatementExecutor*, SlimList*); -typedef void(*Destructor)(void *); -typedef char*(*Method)(void *, SlimList*); - -StatementExecutor* StatementExecutor_Create(void); -void StatementExecutor_Destroy(StatementExecutor*); - -void StatementExecutor_AddFixture(StatementExecutor* executor, Fixture); -void StatementExecutor_RegisterFixture(StatementExecutor*, char const * className, Constructor, Destructor); -void StatementExecutor_RegisterMethod(StatementExecutor*, char const * className, char const * methodName, Method); - -char* StatementExecutor_Make(StatementExecutor*, char const* instanceName, char const* className, SlimList* args); -char* StatementExecutor_Call(StatementExecutor*, char const* instanceName, char const* methodName, SlimList*); -void* StatementExecutor_Instance(StatementExecutor*, char const* instanceName); -void StatementExecutor_SetSymbol(StatementExecutor*, char const* symbol, char const* value); - -void StatementExecutor_ConstructorError(StatementExecutor* executor, char const* message); -char* StatementExecutor_FixtureError(char const* message); - -#endif diff --git a/include/Com/SocketServer.h b/include/Com/SocketServer.h deleted file mode 100644 index 5ea327a..0000000 --- a/include/Com/SocketServer.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef D_SocketServer_H -#define D_SocketServer_H - -/////////////////////////////////////////////////////////////////////////////// -// -// SocketServer is responsible for ... -// -/////////////////////////////////////////////////////////////////////////////// - -typedef struct SocketServer SocketServer; - -SocketServer* SocketServer_Create(void); -void SocketServer_Destroy(SocketServer*); -extern int SocketServer_Run(SocketServer* self, char * port); -extern void SocketServer_register_handler(SocketServer* self, int (*handlerFunction)(int)); - -#endif // D_SocketServer_H diff --git a/include/Com/TcpComLink.h b/include/Com/TcpComLink.h deleted file mode 100644 index 59c8557..0000000 --- a/include/Com/TcpComLink.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef D_TcpComLink_H -#define D_TcpComLink_H - -/////////////////////////////////////////////////////////////////////////////// -// -// TcpComLink is responsible for ... -// -/////////////////////////////////////////////////////////////////////////////// - -typedef struct TcpComLink TcpComLink; - -TcpComLink* TcpComLink_Create(int socket); -void TcpComLink_Destroy(TcpComLink*); -int TcpComLink_send(void * voidSelf, char * msg, int length); -int TcpComLink_recv(void * voidSelf, char * buffer, int length); - -#endif // D_TcpComLink_H diff --git a/include/ComArduino/SerialComLink.h b/include/ComArduino/SerialComLink.h deleted file mode 100644 index d5a8adc..0000000 --- a/include/ComArduino/SerialComLink.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef SERIAL_COM_LINK_H -#define SERIAL_COM_LINK_H - -typedef struct SerialComLink SerialComLink; - -SerialComLink* SerialComLink_Create(); - -void SerialComLink_Destroy(SerialComLink* self); -int SerialComLink_send(void * voidSelf, char * msg, int length); -int SerialComLink_recv(void * voidSelf, char * buffer, int length); - -#endif \ No newline at end of file diff --git a/include/ComArduino/TcpComLink.h b/include/ComArduino/TcpComLink.h deleted file mode 100644 index 90c57b9..0000000 --- a/include/ComArduino/TcpComLink.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef D_TcpComLink_H -#define D_TcpComLink_H - -/////////////////////////////////////////////////////////////////////////////// -// -// TcpComLink is responsible for ... -// -/////////////////////////////////////////////////////////////////////////////// - -typedef struct TcpComLink TcpComLink; - -TcpComLink* TcpComLink_Create(Client *); -void TcpComLink_Destroy(TcpComLink*); -int TcpComLink_send(void * voidSelf, char * msg, int length); -int TcpComLink_recv(void * voidSelf, char * buffer, int length); - -#endif // D_TcpComLink_H diff --git a/include/ExecutorC/SymbolTable.h b/include/ExecutorC/SymbolTable.h deleted file mode 100644 index 4c74c4b..0000000 --- a/include/ExecutorC/SymbolTable.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef D_SymbolTable_H -#define D_SymbolTable_H - -typedef struct SymbolTable SymbolTable; - -SymbolTable* SymbolTable_Create(void); -void SymbolTable_Destroy(SymbolTable*); -char * SymbolTable_FindSymbol(SymbolTable* self, char const* name, int length); -void SymbolTable_SetSymbol(SymbolTable* self, char const* symbol, char const* value); -int SymbolTable_GetSymbolLength(SymbolTable* self, char const* symbol, int length); -#endif diff --git a/include/VS2010/regex.h b/include/VS2010/regex.h deleted file mode 100644 index 7bb7815..0000000 --- a/include/VS2010/regex.h +++ /dev/null @@ -1,3 +0,0 @@ -#ifndef _REGEX_ -#include -#endif diff --git a/src/CSlim/ListExecutor.c b/src/CSlim/ListExecutor.c deleted file mode 100644 index ef50a31..0000000 --- a/src/CSlim/ListExecutor.c +++ /dev/null @@ -1,120 +0,0 @@ -#include "ListExecutor.h" -#include "SlimUtil.h" - -#include -#include -#include - - -struct ListExecutor -{ - StatementExecutor* executor; -}; - -ListExecutor* ListExecutor_Create(StatementExecutor* executor) -{ - ListExecutor* self = (ListExecutor*)malloc(sizeof(ListExecutor)); - memset(self, 0, sizeof(ListExecutor)); - self->executor = executor; - return self; -} - -void ListExecutor_Destroy(ListExecutor* self) -{ - free(self); -} - -static void AddResult(SlimList* list, char* id, char* result) -{ - SlimList* pair = SlimList_Create(); - SlimList_AddString(pair, id); - SlimList_AddString(pair, result); - SlimList_AddList(list, pair); - SlimList_Destroy(pair); -} - -char* InvalidCommand(SlimList* instruction) { - char* id = SlimList_GetStringAt(instruction, 0); - char* command = SlimList_GetStringAt(instruction, 1); - static char msg[128]; - snprintf(msg, (size_t)128, "__EXCEPTION__:message:<>", id, command); - return CSlim_BuyString(msg); -} - -char* MalformedInstruction(SlimList* instruction) { - static char msg[128]; - snprintf(msg, (size_t)128, "__EXCEPTION__:message:<>", SlimList_ToString(instruction)); - return CSlim_BuyString(msg); -} - -char* Import() { - return CSlim_BuyString("OK"); -} - -char* Make(ListExecutor* self, SlimList* instruction) { - char* instanceName = SlimList_GetStringAt(instruction, 2); - char* className = SlimList_GetStringAt(instruction, 3); - SlimList* args = SlimList_GetTailAt(instruction, 4); - char * result = CSlim_BuyString(StatementExecutor_Make(self->executor, instanceName, className, args)); - SlimList_Destroy(args); - return result; -} - -char* Call(ListExecutor* self, SlimList* instruction) { - char *instanceName, *methodName, *result; - SlimList* args; - if (SlimList_GetLength(instruction) < 4) - return MalformedInstruction(instruction); - instanceName = SlimList_GetStringAt(instruction, 2); - methodName = SlimList_GetStringAt(instruction, 3); - args = SlimList_GetTailAt(instruction, 4); - result = CSlim_BuyString(StatementExecutor_Call(self->executor, instanceName, methodName, args)); - SlimList_Destroy(args); - return result; -} - -char* CallAndAssign(ListExecutor* self, SlimList* instruction) { - char *symbolName, *instanceName, *methodName, *result; - SlimList* args; - if (SlimList_GetLength(instruction) < 5) - return MalformedInstruction(instruction); - symbolName = SlimList_GetStringAt(instruction, 2); - instanceName = SlimList_GetStringAt(instruction, 3); - methodName = SlimList_GetStringAt(instruction, 4); - args = SlimList_GetTailAt(instruction, 5); - result = CSlim_BuyString(StatementExecutor_Call(self->executor, instanceName, methodName, args)); - StatementExecutor_SetSymbol(self->executor, symbolName, result); - SlimList_Destroy(args); - return result; -} - -char* Dispatch(ListExecutor* self, SlimList* instruction) { - char* command = SlimList_GetStringAt(instruction, 1); - if (strcmp(command, "import") == 0) - return Import(); - else if (strcmp(command, "make") == 0) - return Make(self, instruction); - else if (strcmp(command, "call") == 0) - return Call(self, instruction); - else if (strcmp(command, "callAndAssign") == 0) - return CallAndAssign(self, instruction); - else - return InvalidCommand(instruction); -} - -SlimList* ListExecutor_Execute(ListExecutor* self, SlimList* instructions) -{ - SlimList* results = SlimList_Create(); - int numberOfInstructions = SlimList_GetLength(instructions); - int n; - for (n=0; n -#include - -#include "Slim.h" -#include "SlimList.h" -#include "SlimListDeserializer.h" -#include "StatementExecutor.h" -#include "ListExecutor.h" -#include "SlimListSerializer.h" - -void AddFixtures(StatementExecutor*); - -struct Slim -{ - StatementExecutor * statementExecutor; - ListExecutor * listExecutor; -}; - -Slim * Slim_Create() -{ - Slim * self = (Slim*)malloc(sizeof(Slim)); - memset(self, 0, sizeof(Slim)); - self->statementExecutor = StatementExecutor_Create(); - AddFixtures(self->statementExecutor); - self->listExecutor = ListExecutor_Create(self->statementExecutor); - return self; -} - -void Slim_Destroy(Slim * self) -{ - ListExecutor_Destroy(self->listExecutor); - StatementExecutor_Destroy(self->statementExecutor); - free(self); -} - -char * Slim_HandleMessage(void* voidSelf, char * message) -{ - Slim* self = (Slim*)voidSelf; - SlimList* instructions = SlimList_Deserialize(message); - SlimList* results = ListExecutor_Execute(self->listExecutor, instructions); - char * response = SlimList_Serialize(results); - SlimList_Destroy(results); - SlimList_Destroy(instructions); - return response; -} - -int Slim_HandleConnection(Slim* self, void* comLink, com_func_t send, com_func_t recv) -{ - int result = 0; - SlimConnectionHandler* connection = SlimConnectionHandler_Create(send, recv, comLink); - SlimConnectionHandler_RegisterSlimMessageHandler(connection, self, &Slim_HandleMessage); - result = SlimConnectionHandler_Run(connection); - SlimConnectionHandler_Destroy(connection); - return result; -} diff --git a/src/CSlim/SlimConnectionHandler.c b/src/CSlim/SlimConnectionHandler.c deleted file mode 100644 index 6847361..0000000 --- a/src/CSlim/SlimConnectionHandler.c +++ /dev/null @@ -1,101 +0,0 @@ -#include "SlimConnectionHandler.h" -#include "SlimListSerializer.h" - -#include -#include -#include -#include - -struct SlimConnectionHandler -{ - com_func_t sendFunc; - com_func_t recvFunc; - void * comLink; - handler_func_t slimHandlerFunc; - void * slimHandler; -}; - -SlimConnectionHandler* SlimConnectionHandler_Create(com_func_t sendFunction, com_func_t recvFunction, void * comLink) -{ - SlimConnectionHandler* self = (SlimConnectionHandler*)malloc(sizeof(SlimConnectionHandler)); - memset(self, 0, sizeof(SlimConnectionHandler)); - self->sendFunc = sendFunction; - self->recvFunc = recvFunction; - self->comLink = comLink; - return self; -} - -void SlimConnectionHandler_Destroy(SlimConnectionHandler* self) -{ - free(self); -} - -void SlimConnectionHandler_RegisterSlimMessageHandler(SlimConnectionHandler* self, void* handler, handler_func_t handlerFunc ) -{ - self->slimHandler = handler; - self->slimHandlerFunc = handlerFunc; -} - -int read_size(SlimConnectionHandler* self) -{ - char size[7]; - size_t size_i = 0; - char colon; - memset(size, (size_t)0, (size_t)7); - - if (self->recvFunc(self->comLink, size, 6) == 6) - { - if ((self->recvFunc(self->comLink, &colon, 1)) == 1 && colon == ':') - { - size_i = atoi(size); - } - } - return (int)size_i; -} - - -int SlimConnectionHandler_Run(SlimConnectionHandler* self) -{ - char * message = (char*)malloc((size_t)3); - message[0] = 0; - int numbytes; - - if (self->sendFunc(self->comLink, "Slim -- V0.0\n", 13) == -1) - { - return -1; - } - - while(1) - { - int size_i = read_size(self); - if (size_i > 0) - { - free(message); - message = (char*)malloc(size_i + (size_t)1); - memset(message, 0, (size_t)size_i + (size_t)1); - numbytes = self->recvFunc(self->comLink, message, size_i); - if (numbytes != size_i) - { - printf("did not receive right number of bytes. %d expected but received %d\n", size_i, numbytes); - break; - } - if (strcmp("bye", message) == 0) - { - break; - } - //execute and get response - char* response_message = self->slimHandlerFunc(self->slimHandler, message); - int response_length = (int)strlen(response_message); - char * length_buffer = (char *)malloc((size_t)8); - sprintf(length_buffer, "%06d:", response_length); - int send_result = self->sendFunc(self->comLink, length_buffer, 7); - free(length_buffer); - send_result = self->sendFunc(self->comLink, response_message, response_length); - SlimList_Release(response_message); - } - } - free(message); - fflush(stdout); - return 0; - -} diff --git a/src/CSlim/SlimList.c b/src/CSlim/SlimList.c deleted file mode 100644 index 65a2d36..0000000 --- a/src/CSlim/SlimList.c +++ /dev/null @@ -1,247 +0,0 @@ -#include "SlimList.h" -#include "SlimUtil.h" -#include "SlimListDeserializer.h" -#include "SlimListSerializer.h" -#include -#include -#include - -//static local variables -typedef struct Node Node; - -struct Node { - Node* next; - char* string; - SlimList* list; -}; - -struct SlimList { - int length; - Node* head; - Node* tail; -}; - -static void insertNode(SlimList* self, Node* node); - -SlimList* SlimList_Create(void) -{ - SlimList* self = (SlimList*)malloc(sizeof(SlimList)); - memset(self, 0, sizeof(SlimList)); - return self; -} - -void SlimList_Destroy(SlimList* self) -{ - Node * node; - Node * next; - for(node = self->head; node; node = next) - { - if (node->string) - free(node->string); - - if (node->list) - SlimList_Destroy(node->list); - - next = node->next; - free(node); - } - free(self); -} - -void SlimList_AddBuffer(SlimList* self, char const* buffer, int length) -{ - Node* newNode = (Node*)malloc(sizeof(Node)); - newNode->next = 0; - newNode->list = 0; - - insertNode(self, newNode); - - newNode->string = CSlim_BuyBuf(buffer, length); -} - - -void SlimList_AddString(SlimList* self, char const* string) -{ - SlimList_AddBuffer(self, string, string ? (int)strlen(string) : 0); -} - -void SlimList_AddList(SlimList* self, SlimList* element) -{ - char * embedded = SlimList_Serialize(element); - SlimList_AddString(self, embedded); - SlimList_Release(embedded); -} - -int SlimList_GetLength(SlimList* self) -{ - return self->length; -} - - -int SlimList_Equals(SlimList* self, SlimList* other){ - Node *p, *q; - if (self->length != other->length) - return 0; - - for (p = self->head, q=other->head; p; p=p->next, q=q->next) - { - if (strcmp(p->string, q->string) != 0) - return 0; - } - - return 1; -} - -Node * SlimList_GetNodeAt(SlimList* self, int index) -{ - int i; - Node* node = self->head; - - if (index >= self->length) - return 0; - - for (i = 0; i < index; i++) - { - node = node->next; - } - return node; -} - -SlimList * SlimList_GetListAt(SlimList* self, int index) -{ - Node * node = SlimList_GetNodeAt(self, index); - if (node) - { - if (node->list == 0) - node->list = SlimList_Deserialize(node->string); - } - return node->list; -} - -char * SlimList_GetStringAt(SlimList* self, int index) -{ - Node* node = SlimList_GetNodeAt(self, index); - if(node == 0) - return 0; - return node->string; -} - -double SlimList_GetDoubleAt(SlimList* self, int index) -{ - char* speed_s = SlimList_GetStringAt(self, index); - return atof(speed_s); -} - -static char * parseHashCell(char ** cellStart) -{ - char * cellValue = *cellStart + strlen(""); - char * cellStop = strstr(cellValue, ""); - - int length = (int)(cellStop - cellValue); - char * buf = (char*)malloc(length + 1); - strncpy(buf, cellValue, length); - buf[length] = 0; - - *cellStart = strstr(cellStop + strlen(""), ""); - - return buf; -} - -static SlimList* parseHashEntry(char * row) -{ - SlimList * element = SlimList_Create(); - - char * cellStart = strstr(row, ""); - - char* hashKey = parseHashCell(&cellStart); - SlimList_AddString(element, hashKey); - free(hashKey); - - char * hashValue = parseHashCell(&cellStart); - SlimList_AddString(element, hashValue); - free(hashValue); - - return element; -} - -static SlimList* SlimList_deserializeHash(char * serializedHash) -{ - SlimList *element; - SlimList *hash = SlimList_Create(); - - char * row = strstr(serializedHash, ""); - while (row != NULL) - { - element = parseHashEntry(row); - SlimList_AddList(hash, element); - SlimList_Destroy(element); - row = strstr(row + strlen(""), ""); - } - return hash; -} - -SlimList* SlimList_GetHashAt(SlimList* self, int index) -{ - return SlimList_deserializeHash(SlimList_GetStringAt(self, 0)); -} - -void SlimList_ReplaceAt(SlimList* self, int index, char const * replacementString) -{ - Node* node = SlimList_GetNodeAt(self, index); - if(node->list != 0){ - SlimList_Destroy(node->list); - node->list = 0; - } - char * newString = CSlim_BuyString(replacementString); - free(node->string); - node->string = newString; -} - -static void insertNode(SlimList* self, Node* node) -{ - if (self->length == 0) - { - self->head = node; - } - else - { - self->tail->next = node; - } - self->tail = node; - self->length++; -} - -SlimList* SlimList_GetTailAt(SlimList* self, int index) -{ - SlimList * tail = SlimList_Create(); - int length = SlimList_GetLength(self); - for(;index < length; index++) { - SlimList_AddString(tail, SlimList_GetStringAt(self, index)); - } - return tail; -} - -char* SlimList_ToString(SlimList* self) { - static char string[128]; - char buf[128]; - buf[0] = '\0'; - strncat(buf, "[", 128); - int length = SlimList_GetLength(self); - int i; - for (i = 0; i -#include - -#define SKIP(a) \ -if (*current != (a))\ -{\ - SlimList_Destroy(list); \ - return 0;\ -}\ -current++; - -int readLength(char const** readPtr) -{ - int length = atoi(*readPtr); - *readPtr += 6; - return length; -} - -SlimList* SlimList_Deserialize(char const* serializedList) -{ - int listLength; - SlimList * list = 0; - char const* current = 0; - - if(serializedList == 0 || strlen(serializedList) == 0) - return 0; - - current = serializedList; - list = SlimList_Create(); - - SKIP('[') - - listLength = readLength(¤t); - - SKIP(':') - - while (listLength--) - { - int elementLength = readLength(¤t); - SKIP(':') - SlimList_AddBuffer(list, current, elementLength); - current += elementLength; - SKIP(':') - } - - SKIP(']') - return list; -} diff --git a/src/CSlim/SlimListSerializer.c b/src/CSlim/SlimListSerializer.c deleted file mode 100644 index c9804e6..0000000 --- a/src/CSlim/SlimListSerializer.c +++ /dev/null @@ -1,50 +0,0 @@ -#include "SlimList.h" -#include "SlimListSerializer.h" -#include -#include -#include - -enum {LIST_OVERHEAD=9, ELEMENT_OVERHEAD=8}; - -char* nodeStringAt(SlimList* self, int i) -{ - char * nodeString = SlimList_GetStringAt(self, i); - if (nodeString == NULL) - nodeString = "null"; - return nodeString; -} - -int SlimList_SerializedLength(SlimList* self) -{ - int length = LIST_OVERHEAD; - int i; - for(i = 0; i < SlimList_GetLength(self); i++) - { - length += strlen(nodeStringAt(self, i)) + ELEMENT_OVERHEAD; - } - return length; -} - -char* SlimList_Serialize(SlimList* self) -{ - char* buf = (char*)malloc(SlimList_SerializedLength(self)+1); - char* write_ptr = buf; - int listLength = SlimList_GetLength(self); - int i; - - write_ptr += sprintf(write_ptr, "[%06d:", listLength); - - for(i = 0; i < listLength; i++) - { - char * nodeString = nodeStringAt(self, i); - write_ptr += sprintf(write_ptr, "%06ld:%s:", (long)strlen(nodeString), nodeString); - } - strcpy(write_ptr, "]"); - return buf; -} - -void SlimList_Release(char *serializedResults) -{ - if(serializedResults) - free(serializedResults); -} diff --git a/src/CSlim/SlimUtil.c b/src/CSlim/SlimUtil.c deleted file mode 100644 index 6373a17..0000000 --- a/src/CSlim/SlimUtil.c +++ /dev/null @@ -1,42 +0,0 @@ -#include -#include -#include "SlimUtil.h" -char * CSlim_BuyBuf(char const* buffer, int length) -{ - if (buffer == NULL) - return NULL; - - char * purchase = (char*)malloc(length+1); - strncpy(purchase, buffer, length); - purchase[length] = 0; - return purchase; -} -char * CSlim_BuyString(char const* string) -{ - if (string == NULL) - return NULL; - return CSlim_BuyBuf(string, (int)strlen(string)); -} - -int CSlim_MapToIntFrom(MapStringInt* map, const char* name) -{ - MapStringInt* p = map; - while (p->string != NULL && 0 != strcmp(name, p->string)) - { - p++; - } - - return p->n; -} - -const char* CSlim_MapToStringFrom(MapStringInt* map, int n) -{ - MapStringInt* p = map; - while (p->string != NULL && n != p->n) - { - p++; - } - - return p->string; -} - diff --git a/src/Com/SocketServer.c b/src/Com/SocketServer.c deleted file mode 100644 index ddd5884..0000000 --- a/src/Com/SocketServer.c +++ /dev/null @@ -1,143 +0,0 @@ -#include "SocketServer.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -//static local variables -struct SocketServer -{ - int (*handler)(int); -}; - -SocketServer* SocketServer_Create(void) -{ - SocketServer* self = (SocketServer*)malloc(sizeof(SocketServer)); - memset(self, 0, sizeof(SocketServer)); - return self; -} - -void SocketServer_Destroy(SocketServer* self) -{ - free(self); -} - -#define BACKLOG 10 // how many pending connections queue will hold - -void sigchld_handler(int s) -{ - while(waitpid(-1, NULL, WNOHANG) > 0); -} - -// get sockaddr, IPv4 or IPv6: -void *get_in_addr(struct sockaddr *sa) -{ - if (sa->sa_family == AF_INET) { - return &(((struct sockaddr_in*)sa)->sin_addr); - } - - return &(((struct sockaddr_in6*)sa)->sin6_addr); -} - -void SocketServer_register_handler(SocketServer* self, int (*handlerFunction)(int)) -{ - self->handler = handlerFunction; -} - -void serve(SocketServer* self, int socket) -{ - (*self->handler)(socket); -} - -int SocketServer_Run(SocketServer* self, char * listening_port_number) -{ - int sockfd, new_fd; // listen on sock_fd, new connection on new_fd - struct addrinfo hints, *servinfo, *p; - struct sockaddr_storage their_addr; // connector's address information - socklen_t sin_size; - struct sigaction sa; - int yes=1; - char s[INET6_ADDRSTRLEN]; - int rv; - - memset(&hints, 0, sizeof hints); - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; - hints.ai_flags = AI_PASSIVE; // use my IP - - if ((rv = getaddrinfo(NULL, listening_port_number, &hints, &servinfo)) != 0) { - fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(rv)); - return 1; - } - - // loop through all the results and bind to the first we can - for(p = servinfo; p != NULL; p = p->ai_next) { - if ((sockfd = socket(p->ai_family, p->ai_socktype, - p->ai_protocol)) == -1) { - perror("server: socket"); - continue; - } - - if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &yes, - sizeof(int)) == -1) { - perror("setsockopt"); - exit(1); - } - - if (bind(sockfd, p->ai_addr, p->ai_addrlen) == -1) { - close(sockfd); - perror("server: bind"); - continue; - } - - break; - } - - if (p == NULL) { - fprintf(stderr, "server: failed to bind\n"); - return 2; - } - - freeaddrinfo(servinfo); // all done with this structure - - if (listen(sockfd, BACKLOG) == -1) { - perror("listen"); - exit(1); - } - - sa.sa_handler = sigchld_handler; // reap all dead processes - sigemptyset(&sa.sa_mask); - sa.sa_flags = SA_RESTART; - if (sigaction(SIGCHLD, &sa, NULL) == -1) { - perror("sigaction"); - exit(1); - } - - sin_size = sizeof their_addr; - new_fd = accept(sockfd, (struct sockaddr *)&their_addr, &sin_size); - if (new_fd == -1) { - perror("accept"); - return -1; - } - - inet_ntop(their_addr.ss_family, - get_in_addr((struct sockaddr *)&their_addr), - s, sizeof s); - - serve(self, new_fd); - - close(new_fd); - - return 0; -} - diff --git a/src/Com/TcpComLink.c b/src/Com/TcpComLink.c deleted file mode 100644 index 214b54e..0000000 --- a/src/Com/TcpComLink.c +++ /dev/null @@ -1,48 +0,0 @@ -#include "TcpComLink.h" -#include -#include -#include - -//static local variables -struct TcpComLink -{ - int socket; -}; - -TcpComLink* TcpComLink_Create(int socket) -{ - TcpComLink* self = (TcpComLink*)malloc(sizeof(TcpComLink)); - memset(self, 0, sizeof(TcpComLink)); - self->socket = socket; - return self; -} - -void TcpComLink_Destroy(TcpComLink* self) -{ - free(self); -} - - -int TcpComLink_send(void * voidSelf, char * msg, int length) -{ - TcpComLink * self = (TcpComLink *)voidSelf; - int total = 0; // how many bytes we've sent - int bytesleft = length; // how many we have left to send - int n; - - while(total < length) { - n = (int)send(self->socket, msg+total, bytesleft, 0); - if (n == -1) { break; } - total += n; - bytesleft -= n; - } - - return total; -} - - -int TcpComLink_recv(void * voidSelf, char * buffer, int length) -{ - TcpComLink * self = (TcpComLink *)voidSelf; - return (int)recv(self->socket, buffer, length, MSG_WAITALL); -} diff --git a/src/ComArduino/SerialComLink.cpp b/src/ComArduino/SerialComLink.cpp deleted file mode 100644 index 9f959db..0000000 --- a/src/ComArduino/SerialComLink.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#include - -#include "SerialComLink.h" -#include "WProgram.h" -//static local variables -struct SerialComLink -{ -}; - -SerialComLink* SerialComLink_Create() -{ - return 0; -} - -void SerialComLink_Destroy(SerialComLink* self) -{ -} - - -int SerialComLink_send(void * voidSelf, char * msg, int length) -{ - Serial.write((uint8_t*)msg, length); - return length; -} - -int SerialComLink_recv(void * voidSelf, char * buffer, int length) -{ - int bytes_read = 0; - - while(Serial.available() <= 0) - { - delay(100); - } - - while(bytes_read < length) { - while(Serial.available() <= 0); - buffer[bytes_read] = (char) Serial.read(); - bytes_read += 1; - } - - return bytes_read; -} diff --git a/src/ComArduino/TcpComLink.cpp b/src/ComArduino/TcpComLink.cpp deleted file mode 100644 index 9045ae7..0000000 --- a/src/ComArduino/TcpComLink.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include "Ethernet.h" - -#include - - -#include "TcpComLink.h" - -//static local variables -struct TcpComLink -{ - Client * client; -}; - -TcpComLink* TcpComLink_Create(Client * client) -{ - TcpComLink* self = (TcpComLink*)malloc(sizeof(TcpComLink)); - memset(self, 0, sizeof(TcpComLink)); - self->client = client; - return self; -} - -void TcpComLink_Destroy(TcpComLink* self) -{ - free(self); -} - - -int TcpComLink_send(void * voidSelf, char * msg, int length) -{ - TcpComLink * self = (TcpComLink *)voidSelf; - self->client->write((uint8_t*)(msg), length); - return length; -} - - -int TcpComLink_recv(void * voidSelf, char * buffer, int length) -{ - TcpComLink * self = (TcpComLink *)voidSelf; - int bytes_read = 0; - - Client * client = self->client; - while(client->available() > 0 && bytes_read < length) { - buffer[bytes_read] = client->read(); - bytes_read += 1; - } - - return bytes_read; -} diff --git a/src/ComWin32/SocketServer.c b/src/ComWin32/SocketServer.c deleted file mode 100644 index 5c0f324..0000000 --- a/src/ComWin32/SocketServer.c +++ /dev/null @@ -1,105 +0,0 @@ -#include "SocketServer.h" -#include -#include - -static void StartWSA(SocketServer* self); -static void BindToSocket(SocketServer* self); -static void Shutdown(SocketServer* self); -static void CreateSocket(SocketServer* self); -static void WaitForConnection(SocketServer* self); - -//static local variables -struct SocketServer -{ - int (*handler)(int); - SOCKET Socket; - int itsPort; -}; - -SocketServer* SocketServer_Create(void) -{ - SocketServer* self = (SocketServer*)malloc(sizeof(SocketServer)); - memset(self, 0, sizeof(SocketServer)); - return self; -} - -void SocketServer_Destroy(SocketServer* self) -{ - Shutdown(self); - free(self); -} - -void SocketServer_register_handler(SocketServer* self, int (*handlerFunction)(int)) -{ - self->handler = handlerFunction; -} - -void serve(SocketServer* self, int socket) -{ - (*self->handler)(socket); -} - -int SocketServer_Run(SocketServer* self, char * listening_port_number) -{ - self->itsPort = atoi(listening_port_number); - StartWSA(self); - CreateSocket(self); - BindToSocket(self); - WaitForConnection(self); - Shutdown(self); - - return 0; -} - -void Shutdown(SocketServer* self) -{ - shutdown(self->Socket,SD_SEND); - closesocket(self->Socket); - WSACleanup(); -} - -void WaitForConnection(SocketServer* self) -{ - listen(self->Socket,1); - - SOCKET TempSock = SOCKET_ERROR; - while(TempSock==SOCKET_ERROR) - { - TempSock = accept(self->Socket,NULL,NULL); - } - - serve(self, TempSock); - - closesocket(TempSock); -} - -void StartWSA(SocketServer* self) -{ - WSADATA WsaDat; - if(WSAStartup(MAKEWORD(2,2),&WsaDat) != 0) - { - printf("WSA Initialization failed!"); - } -} - -void CreateSocket(SocketServer* self) -{ - self->Socket = socket(AF_INET,SOCK_STREAM,IPPROTO_TCP); - if(self->Socket == INVALID_SOCKET) - { - printf("Socket creationg failed."); - } -} - -void BindToSocket(SocketServer* self) -{ - SOCKADDR_IN serverInf; - serverInf.sin_family=AF_INET; - serverInf.sin_addr.s_addr=INADDR_ANY; - serverInf.sin_port=htons(self->itsPort); - - if(bind(self->Socket,(SOCKADDR*)(&serverInf),sizeof(serverInf)) == SOCKET_ERROR) - { - printf("Unable to bind socket!"); - } -} diff --git a/src/ComWin32/TcpComLink.c b/src/ComWin32/TcpComLink.c deleted file mode 100644 index f2ec7df..0000000 --- a/src/ComWin32/TcpComLink.c +++ /dev/null @@ -1,51 +0,0 @@ -#include "TcpComLink.h" -#include - -//static local variables -struct TcpComLink -{ - SOCKET Socket; -}; - -TcpComLink* TcpComLink_Create(int socket) -{ - TcpComLink* self = (TcpComLink*)malloc(sizeof(TcpComLink)); - memset(self, 0, sizeof(TcpComLink)); - self->Socket = socket; - return self; -} - -void TcpComLink_Destroy(TcpComLink* self) -{ - free(self); -} - -int TcpComLink_send(void * voidSelf, char * msg, int length) -{ - TcpComLink * self = (TcpComLink *)voidSelf; - int total = 0; // how many bytes we've sent - int bytesleft = length; // how many we have left to send - int n; - - while(total < length) { - n = send(self->Socket, msg+total, bytesleft, 0); - if (n == -1) { break; } - total += n; - bytesleft -= n; - } - - return total; -} - -int TcpComLink_recv(void * voidSelf, char * buffer, int length) -{ - TcpComLink * self = (TcpComLink *)voidSelf; - - //No MSG_WAITALL flag in winsock2 ???? - int bytesReceived = 0; - while (bytesReceived < length) - { - bytesReceived += recv(self->Socket, buffer + bytesReceived, length - bytesReceived, 0); - } - return bytesReceived; -} diff --git a/src/ExecutorC/StatementExecutor.c b/src/ExecutorC/StatementExecutor.c deleted file mode 100644 index 2bd06dd..0000000 --- a/src/ExecutorC/StatementExecutor.c +++ /dev/null @@ -1,310 +0,0 @@ -#include "StatementExecutor.h" -#include "SlimList.h" -#include "SlimListDeserializer.h" -#include "SlimListSerializer.h" -#include -#include -#include -#include "SlimUtil.h" -// #include -#include "SymbolTable.h" -#include "assert.h" -#include - - -typedef struct methodNode { - struct methodNode* next; - char const* name; - Method method; -} MethodNode; - -typedef struct fixtureNode { - struct fixtureNode* next; - Constructor constructor; - Destructor destructor; - MethodNode* methods; - char const* name; -} FixtureNode; - -typedef struct instanceNode { - struct instanceNode* next; - char const* name; - void* instance; - FixtureNode* fixture; -} InstanceNode; - -typedef struct symbolNode { - struct symbolNode* next; - char const* name; - char const* value; -} SymbolNode; - -struct StatementExecutor -{ - FixtureNode* fixtures; - InstanceNode* instances; - SymbolTable * symbolTable; - char message[120]; - char const* userMessage; -}; - - - -static void destroyInstances(InstanceNode*); -static void destroyFixtures(FixtureNode*); -static void destroyMethods(MethodNode*); -void replaceSymbols(SymbolTable*, SlimList*); -static char* replaceString(SymbolTable*, char*); -static char* replaceStringFrom(SymbolTable*, char*, char*); -static int lengthOfSymbol(char *); -static FixtureNode * findFixture(StatementExecutor* executor, char const * className); -static void Null_Destroy(void* self); -static void* Null_Create(StatementExecutor* executor, SlimList* args); - - -StatementExecutor* StatementExecutor_Create(void) -{ - StatementExecutor* self = (StatementExecutor*)malloc(sizeof(StatementExecutor)); - memset(self, 0, sizeof(StatementExecutor)); - self->symbolTable = SymbolTable_Create(); - return self; -} - -InstanceNode* GetInstanceNode(StatementExecutor* executor, char const* instanceName) -{ - InstanceNode* instanceNode; - for (instanceNode = executor->instances; instanceNode; instanceNode = instanceNode->next) { - if (strcmp(instanceNode->name, instanceName) == 0) { - return instanceNode; - } - } - return NULL; -} - -void StatementExecutor_Destroy(StatementExecutor* self) -{ - destroyInstances(self->instances); - destroyFixtures(self->fixtures); - SymbolTable_Destroy(self->symbolTable); - free(self); -} - -static void destroyInstances(InstanceNode* head) { - InstanceNode* instanceNode; - for (instanceNode = head; instanceNode;) { - InstanceNode* nextInstanceNode = instanceNode->next; - instanceNode->fixture->destructor(instanceNode->instance); - free(instanceNode); - instanceNode = nextInstanceNode; - } -} - -static void destroyFixtures(FixtureNode* head) { - FixtureNode* fixtureNode; - for (fixtureNode = head; fixtureNode;) { - FixtureNode* nextFixtureNode = fixtureNode->next; - destroyMethods(fixtureNode->methods); - free(fixtureNode); - fixtureNode = nextFixtureNode; - } -} - -static void destroyMethods(MethodNode* head) { - MethodNode* node; - for (node = head; node;) { - MethodNode* nextNode = node->next; - free(node); - node = nextNode; - } -} - -char* StatementExecutor_Make(StatementExecutor* executor, char const* instanceName, char const* className, SlimList* args){ - FixtureNode* fixtureNode = findFixture(executor, className); - if (fixtureNode) { - InstanceNode* instanceNode = (InstanceNode* )malloc(sizeof(InstanceNode)); - instanceNode->next = executor->instances; - executor->instances = instanceNode; - instanceNode->name = instanceName; - instanceNode->fixture = fixtureNode; - replaceSymbols(executor->symbolTable, args); - executor->userMessage = NULL; - instanceNode->instance = (fixtureNode->constructor)(executor, args); - if (instanceNode->instance != NULL) { - return "OK"; - } else { - char * formatString = "__EXCEPTION__:message:<>"; - snprintf(executor->message, 120, formatString, className, executor->userMessage ? executor->userMessage : ""); - return executor->message; - } - } - char * formatString = "__EXCEPTION__:message:<>"; - snprintf(executor->message, 120, formatString, className); - return executor->message; -} - -char* StatementExecutor_Call(StatementExecutor* executor, char const* instanceName, char const* methodName, SlimList* args){ - InstanceNode* instanceNode = GetInstanceNode(executor, instanceName); - if (instanceNode) - { - MethodNode* node; - for (node = instanceNode->fixture->methods; node; node = node->next) { - if (strcmp(methodName, node->name) == 0) { - replaceSymbols(executor->symbolTable, args); - char* retval = node->method(instanceNode->instance, args); - return retval; - } - } - char * formatString = "__EXCEPTION__:message:<>"; - snprintf(executor->message, 120, formatString, methodName, SlimList_GetLength(args), instanceNode->fixture->name); - return executor->message; - } - char * formatString = "__EXCEPTION__:message:<>"; - snprintf(executor->message, 120, formatString, instanceName); - return executor->message; -} - -void replaceSymbols(SymbolTable* symbolTable, SlimList* list) { - int i; - for (i=0; iinstance; - return NULL; -} - -void StatementExecutor_AddFixture(StatementExecutor* executor, Fixture fixture) { - fixture(executor); -} - -void StatementExecutor_RegisterFixture(StatementExecutor* executor, char const * className, Constructor constructor, Destructor destructor){ - FixtureNode* fixtureNode = findFixture(executor, className); - if (!fixtureNode) - { - fixtureNode = (FixtureNode*)malloc(sizeof(FixtureNode)); - fixtureNode->next = executor->fixtures; - executor->fixtures = fixtureNode; - fixtureNode->name = className; - fixtureNode->methods = NULL; - } - - fixtureNode->constructor = constructor; - fixtureNode->destructor = destructor; -} - -static FixtureNode * findFixture(StatementExecutor* executor, char const* className) -{ - FixtureNode* fixtureNode = NULL; - for (fixtureNode = executor->fixtures; fixtureNode; fixtureNode = fixtureNode->next) { - if (strcmp(fixtureNode->name, className) == 0) { - break; - } - } - return fixtureNode; -} - -void StatementExecutor_RegisterMethod(StatementExecutor* executor, char const * className, char const * methodName, Method method){ - FixtureNode* fixtureNode = findFixture(executor, className); - if (fixtureNode == NULL) { - StatementExecutor_RegisterFixture(executor, className, Null_Create, Null_Destroy); - fixtureNode = findFixture(executor, className); - } - - MethodNode* node = (MethodNode*)malloc(sizeof(MethodNode)); - node->name = methodName; - node->method = method; - node->next = fixtureNode->methods; - fixtureNode->methods = node; - return; -} - -void StatementExecutor_SetSymbol(StatementExecutor* self, char const* symbol, char const* value) { - SymbolTable_SetSymbol(self->symbolTable, symbol, value); -} - -void StatementExecutor_ConstructorError(StatementExecutor* executor, char const* message) { - executor->userMessage = message; -} - -char* StatementExecutor_FixtureError(char const* message) { - static char buffer[128]; - char * formatString = "__EXCEPTION__:message:<<%.100s.>>"; - snprintf(buffer, 128, formatString, message); - return buffer; -} - -static void* Null_Create(StatementExecutor* executor, SlimList* args) -{ - return NULL; -} - -static void Null_Destroy(void* self) -{ -} - - diff --git a/src/ExecutorC/SymbolTable.c b/src/ExecutorC/SymbolTable.c deleted file mode 100644 index 3f6ad02..0000000 --- a/src/ExecutorC/SymbolTable.c +++ /dev/null @@ -1,63 +0,0 @@ -#include "SymbolTable.h" -#include -#include -#include "SlimUtil.h" - -typedef struct symbolNode { - struct symbolNode* next; - char* name; - char* value; -} SymbolNode; - -struct SymbolTable -{ - SymbolNode * head; -}; - -SymbolTable* SymbolTable_Create(void) -{ - SymbolTable* self = (SymbolTable*)malloc(sizeof(SymbolTable)); - memset(self, 0, sizeof(SymbolTable)); - return self; -} - -void SymbolTable_Destroy(SymbolTable* self) -{ - SymbolNode* node; - for (node = self->head; node;) { - SymbolNode* nextSymbolNode = node->next; - free(node->name); - free(node->value); - free(node); - node = nextSymbolNode; - } - free(self); -} - -char * SymbolTable_FindSymbol(SymbolTable* self, char const * name, int length) { - SymbolNode* node; - for (node = self->head; node; node = node->next) - { - if (strlen(node->name) == length && strncmp(node->name, name, length) == 0) - return node->value; - } - return NULL; -} - -void SymbolTable_SetSymbol(SymbolTable* self, char const * symbol, char const * value) { - SymbolNode * symbolNode = (SymbolNode * )malloc(sizeof(SymbolNode)); - symbolNode->name = CSlim_BuyString(symbol); - symbolNode->value = CSlim_BuyString(value); - symbolNode->next = self->head; - self->head = symbolNode; -} - -int SymbolTable_GetSymbolLength(SymbolTable* self, char const* symbol, int length) -{ - char * symbolValue = SymbolTable_FindSymbol(self, symbol, length); - if (symbolValue == NULL) - return -1; - return strlen(symbolValue); -} - - diff --git a/src/ExecutorObjectiveC/StatementExecutor.m b/src/ExecutorObjectiveC/StatementExecutor.m deleted file mode 100644 index afcd12e..0000000 --- a/src/ExecutorObjectiveC/StatementExecutor.m +++ /dev/null @@ -1,160 +0,0 @@ -#import "StatementExecutor.h" - -void StatementExecutor_ReplaceSymbols(StatementExecutor* executor, SlimList* args); -SEL NSSelectorFromCStringAndLength(char const* methodName, int numberOrArguments); -NSString* SlimList_GetNSStringAt(SlimList* self, int index); -char* noMethodErrorFor(char const* methodName, int length); -NSArray* SlimList_ToNSArray(SlimList* self); -char* NSStringToCString(NSString* string); - -struct StatementExecutor -{ - NSMutableDictionary* instances; - NSMutableDictionary* symbols; - NSAutoreleasePool* pool; -}; - -StatementExecutor* StatementExecutor_Create(void) { - StatementExecutor* self = (StatementExecutor*)malloc(sizeof(StatementExecutor)); - memset(self, 0, sizeof(StatementExecutor)); - self->pool = [[NSAutoreleasePool alloc] init]; - self->instances = [[NSMutableDictionary dictionary] retain]; - self->symbols = [[NSMutableDictionary dictionary] retain]; - return self; -} - -void* StatementExecutor_Instance(StatementExecutor* executor, char const* instanceName) { - return [executor->instances valueForKey: [NSString stringWithFormat: @"%s", instanceName]]; -} - -char* StatementExecutor_Make(StatementExecutor* executor, char const* instanceName, char const* className, SlimList* args){ - NSString* newClassName = [NSString stringWithFormat: @"%s", className]; - for(NSString* symbol in [[executor->symbols keyEnumerator] allObjects]) { - newClassName = [newClassName stringByReplacingOccurrencesOfString: [NSString stringWithFormat: @"$%@", symbol] - withString: [executor->symbols objectForKey: symbol]]; - } - Class class = NSClassFromString(newClassName); - if(class == nil) { - [executor->instances removeObjectForKey: [NSString stringWithFormat: @"%s", instanceName]]; - return NSStringToCString([NSString stringWithFormat: @"__EXCEPTION__:message:<>", newClassName]); - } else { - int length = SlimList_GetLength(args); - StatementExecutor_ReplaceSymbols(executor, args); - @try { - id instance; - if(length == 0) { - instance = [[class alloc] init]; - } else if(length == 1) { - instance = [[class alloc] initWithString: SlimList_GetNSStringAt(args, 0)]; - } else { - instance = [[class alloc] initWithArray: SlimList_ToNSArray(args)]; - } - [executor->instances setValue: instance - forKey: [NSString stringWithFormat: @"%s", instanceName]]; - } - @catch (NSException* exception) { - return "__EXCEPTION__:message:<>"; - } - return "OK"; - } -} - -char* StatementExecutor_Call(StatementExecutor* executor, char const* instanceName, char const* methodName, SlimList* args) { - id instance = StatementExecutor_Instance(executor, instanceName); - int length = SlimList_GetLength(args); - SEL selector = NSSelectorFromCStringAndLength(methodName, length); - if(instance == NULL) { - return NSStringToCString([NSString stringWithFormat: @"__EXCEPTION__:message:<>", instanceName]); - } - if(![instance respondsToSelector: selector]) { - return noMethodErrorFor(methodName, length); - } - StatementExecutor_ReplaceSymbols(executor, args); - NSMethodSignature* signature = [instance methodSignatureForSelector: selector]; - NSString* returnType = [NSString stringWithUTF8String: [signature methodReturnType]]; - id result; - @try { - if(length == 0) { - result = [instance performSelector: selector]; - } else if (length == 1) { - result = [instance performSelector: selector withObject: SlimList_GetNSStringAt(args, 0)]; - } else { - result = [instance performSelector: selector withObject: SlimList_ToNSArray(args)]; - } - if ([returnType isEqualToString: @"@"]) { - if([NSStringFromClass([result class]) isEqualToString: @"NSCFString"]) { - return NSStringToCString(result); - } else { - return NSStringToCString([result stringValue]); - } - } else if ([returnType isEqualToString: @"i"]) { - return NSStringToCString([NSString stringWithFormat: @"%d", result]); - } else { - return "OK"; - } - } @catch (NSException* e) { - return NSStringToCString([NSString stringWithFormat: @"__EXCEPTION__:message:<<%@ %@>>", [e name], [e reason]]); - } -} - -void StatementExecutor_ReplaceSymbols(StatementExecutor* executor, SlimList* args) { - for(int i=0; isymbols keyEnumerator] allObjects]) { - newArgument = [newArgument stringByReplacingOccurrencesOfString: [NSString stringWithFormat: @"$%@", symbol] - withString: [executor->symbols objectForKey: symbol]]; - SlimList_ReplaceAt(args, i, NSStringToCString(newArgument)); - } - } -} - -void StatementExecutor_SetSymbol(StatementExecutor* self, char const* symbol, char const* value) { - [self->symbols setObject: [NSString stringWithUTF8String: value] - forKey: [NSString stringWithUTF8String: symbol]]; -} - - -void StatementExecutor_Destroy(StatementExecutor* self) { - [self->instances release]; - [self->symbols release]; - [self->pool drain]; - free(self); -} - - -void StatementExecutor_AddFixture(StatementExecutor* executor, Fixture fixture) { -} -void StatementExecutor_RegisterFixture(StatementExecutor* executor, char const * className, Constructor constructor, Destructor destructor){ -} -void StatementExecutor_RegisterMethod(StatementExecutor* executor, char const * className, char const * methodName, Method method){ -} - - -char* noMethodErrorFor(char const* methodName, int length) { - return NSStringToCString([NSString stringWithFormat: @"__EXCEPTION__:message:<>", methodName, length]); -} - -SEL NSSelectorFromCStringAndLength(char const* methodName, int numberOrArguments) { - if (numberOrArguments == 0) { - return NSSelectorFromString([NSString stringWithFormat:@"%s", methodName]); - } else { - return NSSelectorFromString([NSString stringWithFormat:@"%s:", methodName]); - } -} - -NSArray* SlimList_ToNSArray(SlimList* self) { - int length = SlimList_GetLength(self); - NSMutableArray* array = [NSMutableArray array]; - for(int i=0; i>", SlimList_GetStringAt(invalidStatementResult, 1)); - SlimList_Destroy(results); -} - -TEST(ListExecutor, CanCallASimpleFunction) -{ - char const * call[] = {"call1", "call", "test_slim", "returnValue", 0}; - addStatementTo(instructions, call); - - - SlimList * results = ListExecutor_Execute(listExecutor, instructions); - LONGS_EQUAL(3, SlimList_GetLength(results)); - - SlimList * makeResult = SlimList_GetListAt(results, 1); - STRCMP_EQUAL("m1", SlimList_GetStringAt(makeResult, 0)); - STRCMP_EQUAL("OK", SlimList_GetStringAt(makeResult, 1)); - - SlimList * callResult = SlimList_GetListAt(results, 2); - STRCMP_EQUAL("call1", SlimList_GetStringAt(callResult, 0)); - STRCMP_EQUAL("value", SlimList_GetStringAt(callResult, 1)); - - SlimList_Destroy(results); - -} - -TEST(ListExecutor, CantExecuteMalformedInstruction) -{ - char const * call[] = {"call1", "call", "notEnoughArguments", 0}; - addStatementTo(instructions, call); - SlimList * results = ListExecutor_Execute(listExecutor, instructions); - SlimList * invalidStatementResult = SlimList_GetListAt(results, 2); - STRCMP_EQUAL("__EXCEPTION__:message:<>", SlimList_GetStringAt(invalidStatementResult, 1)); - SlimList_Destroy(results); -} - -TEST(ListExecutor, CantCallAmethodOnAnInstanceThatDoesntExist) -{ - char const * call[] = {"call1", "call", "noSuchInstance", "method", 0}; - addStatementTo(instructions, call); - SlimList * results = ListExecutor_Execute(listExecutor, instructions); - SlimList * invalidStatementResult = SlimList_GetListAt(results, 2); - STRCMP_EQUAL("__EXCEPTION__:message:<>", SlimList_GetStringAt(invalidStatementResult, 1)); - SlimList_Destroy(results); -} - -TEST(ListExecutor, ShouldRespondToAnEmptySetOfInstructionsWithAnEmptySetOfResults) -{ - SlimList* instructions = SlimList_Create(); - SlimList * results = ListExecutor_Execute(listExecutor, instructions); - LONGS_EQUAL(0, SlimList_GetLength(results)); - SlimList_Destroy(results); - SlimList_Destroy(instructions); -} - -TEST(ListExecutor, CanPassArgumentsToConstructor) -{ - char const * make2[] = {"make2", "make", "test_slim2", "TestSlim", "ConstructorArgument", 0}; - char const * call[] = {"call1", "call", "test_slim2", "getConstructionArg", 0}; - addStatementTo(instructions, make2); - addStatementTo(instructions, call); - SlimList * results = ListExecutor_Execute(listExecutor, instructions); - SlimList * callResult = SlimList_GetListAt(results, 3); - STRCMP_EQUAL("ConstructorArgument", SlimList_GetStringAt(callResult, 1)); - SlimList_Destroy(results); -} - -TEST(ListExecutor, CanCallAFunctionMoreThanOnce) -{ - char const * call[] = {"call1", "call", "test_slim", "echo", "Hello", 0}; - addStatementTo(instructions, call); - char const * call2[] = {"call2", "call", "test_slim", "echo", "Goodbye", 0}; - addStatementTo(instructions, call2); - - SlimList * results = ListExecutor_Execute(listExecutor, instructions); - - SlimList * callResult = SlimList_GetListAt(results, 2); - STRCMP_EQUAL("Hello", SlimList_GetStringAt(callResult, 1)); - callResult = SlimList_GetListAt(results, 3); - STRCMP_EQUAL("Goodbye", SlimList_GetStringAt(callResult, 1)); - - SlimList_Destroy(results); -} - -TEST(ListExecutor, CanAssignTheReturnValueToASymbol) -{ - char const * call[] = {"id1", "callAndAssign", "v", "test_slim", "add", "x", "y", 0}; - addStatementTo(instructions, call); - - char const * call2[] = {"id2", "call", "test_slim", "echo", "$v", 0}; - addStatementTo(instructions, call2); - - SlimList * results = ListExecutor_Execute(listExecutor, instructions); - - SlimList * callResult = SlimList_GetListAt(results, 2); - STRCMP_EQUAL("xy", SlimList_GetStringAt(callResult, 1)); - callResult = SlimList_GetListAt(results, 3); - STRCMP_EQUAL("xy", SlimList_GetStringAt(callResult, 1)); - - SlimList_Destroy(results); -} - -TEST(ListExecutor, CanReplateMultipleSymbolsInASingleArgument) -{ - char const * call[] = {"id1", "callAndAssign", "v1", "test_slim", "echo", "Bob", 0}; - addStatementTo(instructions, call); - - char const * call2[] = {"id2", "callAndAssign", "v2", "test_slim", "echo", "Martin", 0}; - addStatementTo(instructions, call2); - - char const * call3[] = {"id2", "call", "test_slim", "echo", "name: $v1 $v2 $12.23", 0}; - addStatementTo(instructions, call3); - - SlimList * results = ListExecutor_Execute(listExecutor, instructions); - - SlimList * callResult = SlimList_GetListAt(results, 4); - STRCMP_EQUAL("name: Bob Martin $12.23", SlimList_GetStringAt(callResult, 1)); - - SlimList_Destroy(results); -} - -TEST(ListExecutor, CanPassAndReturnAList) -{ - SlimList* l = SlimList_Create(); - SlimList_AddString(l, "1"); - SlimList_AddString(l, "2"); - - SlimList* statement = SlimList_Create(); - SlimList_AddString(statement, "id1"); - SlimList_AddString(statement, "call"); - SlimList_AddString(statement, "test_slim"); - SlimList_AddString(statement, "echo"); - SlimList_AddList(statement, l); - - SlimList_AddList(instructions, statement); - SlimList_Destroy(statement); - - SlimList * results = ListExecutor_Execute(listExecutor, instructions); - - SlimList * callResult = SlimList_GetListAt(results, 2); - SlimList * resultList = SlimList_GetListAt(callResult, 1); - CHECK(SlimList_Equals(l, resultList)); - - SlimList_Destroy(results); - SlimList_Destroy(l); -} - -TEST(ListExecutor, CanReturnNull) -{ - char const * call[] = {"id1", "call", "test_slim", "null", 0}; - addStatementTo(instructions, call); - - SlimList * results = ListExecutor_Execute(listExecutor, instructions); - - SlimList * callResult = SlimList_GetListAt(results, 2); - - STRCMP_EQUAL("null", SlimList_GetStringAt(callResult, 1)); - - SlimList_Destroy(results); -} - -TEST(ListExecutor, CanPassASymbolInAList) -{ - char const * call[] = {"id1", "callAndAssign", "v", "test_slim", "echo", "Bob", 0}; - addStatementTo(instructions, call); - - SlimList* statement = SlimList_Create(); - SlimList_AddString(statement, "id2"); - SlimList_AddString(statement, "call"); - SlimList_AddString(statement, "test_slim"); - SlimList_AddString(statement, "echo"); - - SlimList* l = SlimList_Create(); - SlimList_AddString(l, "$v"); - SlimList_AddList(statement, l); - - SlimList_AddList(instructions, statement); - SlimList_Destroy(statement); - - SlimList * results = ListExecutor_Execute(listExecutor, instructions); - - SlimList * callResult = SlimList_GetListAt(results, 3); - SlimList * resultList = SlimList_GetListAt(callResult, 1); - - SlimList* expected = SlimList_Create(); - SlimList_AddString(expected, "Bob"); - - CHECK(SlimList_Equals(expected, resultList)); - - SlimList_Destroy(results); - SlimList_Destroy(l); - SlimList_Destroy(expected); - -} diff --git a/tests/CSlim/SlimConnectionHandlerTest.cpp b/tests/CSlim/SlimConnectionHandlerTest.cpp deleted file mode 100644 index 1fa20fc..0000000 --- a/tests/CSlim/SlimConnectionHandlerTest.cpp +++ /dev/null @@ -1,87 +0,0 @@ -#include "CppUTest/TestHarness.h" -#include -#include -#include - -extern "C" -{ - #include "SlimConnectionHandler.h" - #include "CppUTest/TestHarness_c.h" - - struct MockComLink { - char lastSendMsg[32]; - int lastSendIndex; - char const * recvStream; - char const * recvPtr; - }; - int mock_send_func(void * voidSelf, char * msg, int length) - { - MockComLink * self = (MockComLink*)voidSelf; - strncpy(self->lastSendMsg + self->lastSendIndex, msg, length); - self->lastSendIndex += length; - return length; - } - int mock_recv_func(void * voidSelf, char * buffer, int length) - { - MockComLink * self = (MockComLink*)voidSelf; - strncpy(buffer, self->recvPtr, length); - self->recvPtr += length; - return length; - } - - char * slimResponse; - char sentSlimMessage[32]; - void * sentMsgHandler; - char * mock_handle_slim_message(void* self, char * message) - { - strcpy(sentSlimMessage, message); - sentMsgHandler = self; - return slimResponse; - } - -} - -TEST_GROUP(SlimConnectionHandler) -{ - SlimConnectionHandler* slimConnectionHandler; - MockComLink comLink; - void* mockMessageHandler; - void setup() - { - slimConnectionHandler = SlimConnectionHandler_Create(&mock_send_func, &mock_recv_func, (void*)&comLink); - memset(comLink.lastSendMsg, 0, 32); - comLink.lastSendIndex = 0; - mockMessageHandler = (void*)0x123456; - SlimConnectionHandler_RegisterSlimMessageHandler(slimConnectionHandler, mockMessageHandler, &mock_handle_slim_message); - } - - void teardown() - { - SlimConnectionHandler_Destroy(slimConnectionHandler); - } -}; - -TEST(SlimConnectionHandler, ShouldSendVersion) -{ - comLink.recvStream = "000003:bye"; - comLink.recvPtr = comLink.recvStream; - - SlimConnectionHandler_Run(slimConnectionHandler); - - STRCMP_EQUAL("Slim -- V0.0\n", comLink.lastSendMsg); -} - -TEST(SlimConnectionHandler, ShouldReadMessageAndCallSlimHandler) -{ - comLink.recvStream = "000006:abcdef000003:bye"; - comLink.recvPtr = comLink.recvStream; - - slimResponse = (char*)cpputest_malloc(8); - strcpy(slimResponse, "ghijklm"); - - SlimConnectionHandler_Run(slimConnectionHandler); - - STRCMP_EQUAL("Slim -- V0.0\n000007:ghijklm", comLink.lastSendMsg); - STRCMP_EQUAL("abcdef", sentSlimMessage); - CHECK_EQUAL(mockMessageHandler, sentMsgHandler); -} diff --git a/tests/CSlim/SlimListDeserializerTest.cpp b/tests/CSlim/SlimListDeserializerTest.cpp deleted file mode 100644 index 85cd583..0000000 --- a/tests/CSlim/SlimListDeserializerTest.cpp +++ /dev/null @@ -1,136 +0,0 @@ -#include -#include -#include - -extern "C" -{ -#include "SlimList.h" -#include "SlimListDeserializer.h" -#include "SlimListSerializer.h" -} - -#include "CppUTest/TestHarness.h" -#include "CppUTest/TestHarness_c.h" - -TEST_GROUP(SlimListDeserializer) -{ - SlimList* slimList; - SlimList* deserializedList; - char* serializedList; - - void setup() - { - slimList = SlimList_Create(); - serializedList = 0; - deserializedList = 0; - } - - void teardown() - { - SlimList_Destroy(slimList); - - if (deserializedList) - SlimList_Destroy(deserializedList); - - if (serializedList != 0) - SlimList_Release(serializedList); - } - - void check_lists_equal(SlimList* expected, SlimList* actual) { - CHECK(SlimList_Equals(expected, actual)); - } - -}; - - -TEST(SlimListDeserializer, deserializeEmptyList) -{ - deserializedList = SlimList_Deserialize("[000000:]"); - CHECK(deserializedList != 0); - LONGS_EQUAL(0, SlimList_GetLength(deserializedList)); -} - -TEST(SlimListDeserializer, deserializeNull) -{ - SlimList* list = SlimList_Deserialize(0); - POINTERS_EQUAL(0, list); -} - -TEST(SlimListDeserializer, deserializeEmptyString) -{ - SlimList* list = SlimList_Deserialize(""); - POINTERS_EQUAL(0, list); -} - -TEST(SlimListDeserializer, MissingOpenBracketReturnsNull) -{ - SlimList* list = SlimList_Deserialize("hello"); - POINTERS_EQUAL(0, list); -} - -TEST(SlimListDeserializer, MissingClosingBracketReturnsNull) -{ - SlimList* list = SlimList_Deserialize("[000000:"); - POINTERS_EQUAL(0, list); -} - -TEST(SlimListDeserializer, canDeserializeCanonicalListWithOneElement) -{ - char const* canonicalList = "[000001:000008:Hi doug.:]"; - SlimList* deserializedList = SlimList_Deserialize(canonicalList); - CHECK(deserializedList != NULL); - LONGS_EQUAL(1, SlimList_GetLength(deserializedList)); - STRCMP_EQUAL("Hi doug.", SlimList_GetStringAt(deserializedList, 0)); - SlimList_Destroy(deserializedList); -} - - -TEST(SlimListDeserializer, canDeSerializeListWithOneElement) -{ - SlimList_AddString(slimList, "hello"); - serializedList = SlimList_Serialize(slimList); - deserializedList = SlimList_Deserialize(serializedList); - CHECK(deserializedList != 0); - check_lists_equal(slimList, deserializedList); -} - -TEST(SlimListDeserializer, canDeSerializeListWithTwoElements) -{ - SlimList_AddString(slimList, "hello"); - SlimList_AddString(slimList, "bob"); - serializedList = SlimList_Serialize(slimList); - deserializedList = SlimList_Deserialize(serializedList); - CHECK(deserializedList != 0); - check_lists_equal(slimList, deserializedList); -} - -TEST(SlimListDeserializer, canAddSubList) -{ - SlimList* embeddedList; - embeddedList = SlimList_Create(); - SlimList_AddString(embeddedList, "element"); - SlimList_AddList(slimList, embeddedList); - serializedList = SlimList_Serialize(slimList); - deserializedList = SlimList_Deserialize(serializedList); - SlimList * subList = SlimList_GetListAt(deserializedList, 0); - subList = SlimList_GetListAt(deserializedList, 0); - check_lists_equal(embeddedList, subList); - - SlimList_Destroy(embeddedList); -} - -TEST(SlimListDeserializer, getStringWhereThereIsAList) -{ - SlimList* embeddedList; - embeddedList = SlimList_Create(); - SlimList_AddString(embeddedList, "element"); - SlimList_AddList(slimList, embeddedList); - serializedList = SlimList_Serialize(slimList); - deserializedList = SlimList_Deserialize(serializedList); - char * string = SlimList_GetStringAt(deserializedList, 0); - - STRCMP_EQUAL("[000001:000007:element:]", string); - // POINTERS_EQUAL(0, string); ????????????????????????????????????? - - SlimList_Destroy(embeddedList); -} diff --git a/tests/CSlim/SlimListSerializerTest.cpp b/tests/CSlim/SlimListSerializerTest.cpp deleted file mode 100644 index 85dd805..0000000 --- a/tests/CSlim/SlimListSerializerTest.cpp +++ /dev/null @@ -1,115 +0,0 @@ -#include -#include -#include - - -extern "C" -{ -#include "SlimList.h" -#include "SlimListSerializer.h" -} - -#include "CppUTest/TestHarness.h" -#include "CppUTest/TestHarness_c.h" - -TEST_GROUP(SlimListSerializer) -{ - SlimList* slimList; - char* serializedList; - - void setup() - { - slimList = SlimList_Create(); - serializedList = 0; - } - - void teardown() - { - SlimList_Destroy(slimList); - - SlimList_Release(serializedList); - } -}; - -TEST(SlimListSerializer, SerializeAListWithNoElements) -{ - serializedList = SlimList_Serialize(slimList); - STRCMP_EQUAL("[000000:]", serializedList); -} - -TEST(SlimListSerializer, SerializeAListWithOneElements) -{ - SlimList_AddString(slimList, "hello"); - serializedList = SlimList_Serialize(slimList); - STRCMP_EQUAL("[000001:000005:hello:]", serializedList); -} - -TEST(SlimListSerializer, SerializeAListWithTwoElements) -{ - SlimList_AddString(slimList, "hello"); - SlimList_AddString(slimList, "world"); - - serializedList = SlimList_Serialize(slimList); - - STRCMP_EQUAL("[000002:000005:hello:000005:world:]", serializedList); -} - -TEST(SlimListSerializer, ListCopysItsString) -{ - char string[12] = "Hello"; - SlimList_AddString(slimList, string); - strcpy(string, "Goodbye"); - serializedList = SlimList_Serialize(slimList); - STRCMP_EQUAL("[000001:000005:Hello:]", serializedList); -} - -TEST(SlimListSerializer, canCopyAList) -{ - SlimList_AddString(slimList, "123456"); - SlimList_AddString(slimList, "987654"); - - SlimList* copy = SlimList_Create(); - int i; - for (i=0; i -#include -#include - -extern "C" -{ -#include "SlimList.h" -} - -#include "CppUTest/TestHarness.h" -#include "CppUTest/TestHarness_c.h" - -TEST_GROUP(SlimList) -{ - SlimList* slimList; - SlimList* deserializedList; - char* serializedList; - - void setup() - { - slimList = SlimList_Create(); - serializedList = 0; - deserializedList = 0; - } - - void teardown() - { - SlimList_Destroy(slimList); - - if (deserializedList) - SlimList_Destroy(deserializedList); - - if (serializedList != 0) - cpputest_free(serializedList); - } - - void check_lists_equal(SlimList* expected, SlimList* actual) { - CHECK(SlimList_Equals(expected, actual)); - } - -}; - -TEST(SlimList, twoEmptyListsAreEqual) -{ - SlimList* list = SlimList_Create(); - check_lists_equal(slimList, list); - SlimList_Destroy(list); -} - -TEST(SlimList, twoDifferentLenghtListsAreNotEqual) -{ - SlimList* list = SlimList_Create(); - SlimList_AddString(slimList, "hello"); - CHECK(!SlimList_Equals(slimList, list)); - SlimList_Destroy(list); -} - -TEST(SlimList, twoSingleElementListsWithDifferentElmementsAreNotEqual) -{ - SlimList* list = SlimList_Create(); - SlimList_AddString(slimList, "hello"); - SlimList_AddString(list, "goodbye"); - CHECK(!SlimList_Equals(slimList, list)); - SlimList_Destroy(list); -} - - -TEST(SlimList, twoIdenticalMultipleElementListsElmementsAreEqual) -{ - SlimList* list = SlimList_Create(); - SlimList_AddString(slimList, "hello"); - SlimList_AddString(slimList, "goodbye"); - SlimList_AddString(list, "hello"); - SlimList_AddString(list, "goodbye"); - CHECK(SlimList_Equals(slimList, list)); - SlimList_Destroy(list); -} - - -TEST(SlimList, twoNonIdenticalMultipleElementListsElmementsAreNotEqual) -{ - SlimList* list = SlimList_Create(); - SlimList_AddString(slimList, "hello"); - SlimList_AddString(slimList, "hello"); - SlimList_AddString(list, "hello"); - SlimList_AddString(list, "goodbye"); - CHECK(!SlimList_Equals(slimList, list)); - SlimList_Destroy(list); -} - - -TEST(SlimList, canGetElements) -{ - SlimList_AddString(slimList, "element1"); - SlimList_AddString(slimList, "element2"); - STRCMP_EQUAL("element1", SlimList_GetStringAt(slimList, 0)); - STRCMP_EQUAL("element2", SlimList_GetStringAt(slimList, 1)); -} - -TEST(SlimList, canGetHashWithOneElement) -{ - SlimList_AddString(slimList, "
namebob
"); - - SlimList * hash = SlimList_GetHashAt(slimList, 0); - SlimList * twoElementList = SlimList_GetListAt(hash, 0); - - STRCMP_EQUAL("name", SlimList_GetStringAt(twoElementList, 0)); - STRCMP_EQUAL("bob", SlimList_GetStringAt(twoElementList, 1)); - SlimList_Destroy(hash); -} - -TEST(SlimList, canGetHashWithMultipleElements) -{ - SlimList_AddString(slimList, "
namedough
addrhere
"); - - SlimList * hash = SlimList_GetHashAt(slimList, 0); - SlimList * twoElementList = SlimList_GetListAt(hash,1); - - STRCMP_EQUAL("addr", SlimList_GetStringAt(twoElementList, 0)); - STRCMP_EQUAL("here", SlimList_GetStringAt(twoElementList, 1)); - SlimList_Destroy(hash); -} - -TEST(SlimList, cannotGetElementThatAreNotThere) -{ - SlimList_AddString(slimList, "element1"); - SlimList_AddString(slimList, "element2"); - POINTERS_EQUAL(0, SlimList_GetStringAt(slimList, 3)); -} - -TEST(SlimList, canReplaceString) -{ - SlimList_AddString(slimList, "replaceMe"); - SlimList_ReplaceAt(slimList, 0, "WithMe"); - - STRCMP_EQUAL("WithMe", SlimList_GetStringAt(slimList, 0)); -} - -TEST(SlimList, canGetTail) -{ - SlimList_AddString(slimList, "1"); - SlimList_AddString(slimList, "2"); - SlimList_AddString(slimList, "3"); - SlimList_AddString(slimList, "4"); - - SlimList* expected = SlimList_Create(); - SlimList_AddString(expected, "3"); - SlimList_AddString(expected, "4"); - - SlimList* tail = SlimList_GetTailAt(slimList, 2); - CHECK(SlimList_Equals(expected, tail)); - SlimList_Destroy(tail); - SlimList_Destroy(expected); -} - -TEST(SlimList, recursiveToString) -{ - SlimList_AddString(slimList, "a"); - SlimList_AddString(slimList, "b"); - - SlimList* sublist = SlimList_Create(); - SlimList_AddString(sublist, "3"); - SlimList_AddString(sublist, "4"); - - SlimList_AddList(slimList, sublist); - - STRCMP_EQUAL("[\"a\", \"b\", [\"3\", \"4\"]]", SlimList_ToString(slimList)); - - SlimList_Destroy(sublist); -} - -TEST(SlimList, getDouble) -{ - SlimList_AddString(slimList, "2.3"); - DOUBLES_EQUAL(2.3, SlimList_GetDoubleAt(slimList, 0), 0.1); -} diff --git a/tests/CSlim/StatementExecutorTest.cpp b/tests/CSlim/StatementExecutorTest.cpp deleted file mode 100644 index 61631da..0000000 --- a/tests/CSlim/StatementExecutorTest.cpp +++ /dev/null @@ -1,284 +0,0 @@ -#include "CppUTest/TestHarness.h" - -extern "C" -{ -#include "StatementExecutor.h" -#include "TestSlim.h" -#include "SlimList.h" -#include "SlimListDeserializer.h" -#include -#include -} - -TEST_GROUP(StatementExecutor) -{ - StatementExecutor* statementExecutor; - SlimList* args; - SlimList* empty; - - void setup() - { - args = SlimList_Create(); - empty = SlimList_Create(); - statementExecutor = StatementExecutor_Create(); - StatementExecutor_AddFixture(statementExecutor, TestSlim_Register); - StatementExecutor_Make(statementExecutor, "test_slim", "TestSlim", empty); - } - - void teardown() - { - StatementExecutor_Destroy(statementExecutor); - SlimList_Destroy(args); - SlimList_Destroy(empty); - } -}; - -TEST(StatementExecutor, canCallFunctionWithNoArguments) -{ - StatementExecutor_Call(statementExecutor, "test_slim", "noArgs", args); - TestSlim* testSlim = (TestSlim*)StatementExecutor_Instance(statementExecutor, "test_slim"); - CHECK(TestSlim_noArgsCalled(testSlim)); -} - -TEST(StatementExecutor, cantCallFunctionThatDoesNotExist) -{ - char* result = StatementExecutor_Call(statementExecutor, "test_slim", "noSuchMethod", args); - STRCMP_EQUAL("__EXCEPTION__:message:<>", result); - - result = StatementExecutor_Call(statementExecutor, "test_slim", "noOtherSuchMethod", args); - STRCMP_EQUAL("__EXCEPTION__:message:<>", result); -} - -TEST(StatementExecutor, shouldTruncateReallyLongNamedFunctionThatDoesNotExistTo32) -{ - char * result = StatementExecutor_Call(statementExecutor, "test_slim", "noOtherSuchMethod123456789022345678903234567890423456789052345678906234567890", args); - CHECK(strlen(result) < 120); - STRCMP_EQUAL("__EXCEPTION__:message:<>", result); -} - -TEST(StatementExecutor, shouldKnowNumberofArgumentsforNonExistantFunction) -{ - SlimList_AddString(args, "BlahBlah"); - char* result = StatementExecutor_Call(statementExecutor, "test_slim", "noSuchMethod", args); - STRCMP_EQUAL("__EXCEPTION__:message:<>", result); -} - -TEST(StatementExecutor, shouldNotAllowACallToaNonexistentInstance) -{ - char* result = StatementExecutor_Call(statementExecutor, "noSuchInstance", "noArgs", args); - STRCMP_EQUAL("__EXCEPTION__:message:<>", result); -} - -TEST(StatementExecutor, shouldNotAllowAMakeOnANonexistentClass) -{ - char * result = StatementExecutor_Make(statementExecutor, "instanceName", "NoSuchClass", empty); - STRCMP_EQUAL("__EXCEPTION__:message:<>", result); -} - -TEST(StatementExecutor, canCallaMethodThatReturnsAValue) { - char* result = StatementExecutor_Call(statementExecutor, "test_slim", "returnValue", args); - STRCMP_EQUAL("value", result); -} - -TEST(StatementExecutor, canCallaMethodThatTakesASlimList) -{ - - SlimList_AddString(args, "hello world"); - - char* result = StatementExecutor_Call(statementExecutor, "test_slim", "echo", args); - STRCMP_EQUAL("hello world", result); -} - -TEST(StatementExecutor, canCallTwoInstancesOfTheSameFixture) -{ - SlimList* args2 = SlimList_Create(); - SlimList_AddString(args, "one"); - SlimList_AddString(args2, "two"); - - StatementExecutor_Make(statementExecutor, "test_slim2", "TestSlim", empty); - StatementExecutor_Call(statementExecutor, "test_slim", "setArg", args); - StatementExecutor_Call(statementExecutor, "test_slim2", "setArg", args2); - char* one = StatementExecutor_Call(statementExecutor, "test_slim", "getArg", empty); - char* two = StatementExecutor_Call(statementExecutor, "test_slim2", "getArg", empty); - STRCMP_EQUAL("one", one); - STRCMP_EQUAL("two", two); - SlimList_Destroy(args2); -} - -TEST(StatementExecutor, canCreateTwoDifferentFixtures) -{ - SlimList* args2 = SlimList_Create(); - SlimList_AddString(args, "one"); - SlimList_AddString(args2, "two"); - - StatementExecutor_Make(statementExecutor, "test_slim2", "TestSlimAgain", empty); - StatementExecutor_Call(statementExecutor, "test_slim", "setArg", args); - StatementExecutor_Call(statementExecutor, "test_slim2", "setArgAgain", args2); - char* one = StatementExecutor_Call(statementExecutor, "test_slim", "getArg", empty); - char* two = StatementExecutor_Call(statementExecutor, "test_slim2", "getArgAgain", empty); - STRCMP_EQUAL("one", one); - STRCMP_EQUAL("two", two); - SlimList_Destroy(args2); -} -TEST(StatementExecutor, canReplaceSymbolsWithTheirValue) -{ - StatementExecutor_SetSymbol(statementExecutor, "v", "bob"); - SlimList_AddString(args, "hi $v."); - char * result = StatementExecutor_Call(statementExecutor, "test_slim", "echo", args); - LONGS_EQUAL(strlen("hi bob."), strlen(result)) - STRCMP_EQUAL("hi bob.", result) -} - -TEST(StatementExecutor, canReplaceSymbolsInTheMiddle) -{ - StatementExecutor_SetSymbol(statementExecutor, "v", "bob"); - SlimList_AddString(args, "hi $v whats up."); - STRCMP_EQUAL("hi bob whats up.", StatementExecutor_Call(statementExecutor, "test_slim", "echo", args)) -} - -TEST(StatementExecutor, canReplaceSymbolsWithOtherNonAlphaNumeric) -{ - StatementExecutor_SetSymbol(statementExecutor, "v2", "bob"); - SlimList_AddString(args, "$v2=why"); - STRCMP_EQUAL("bob=why", StatementExecutor_Call(statementExecutor, "test_slim", "echo", args)) -} - -TEST(StatementExecutor, canReplaceMultipleSymbolsWithTheirValue) -{ - StatementExecutor_SetSymbol(statementExecutor, "v", "bob"); - StatementExecutor_SetSymbol(statementExecutor, "e", "doug"); - SlimList_AddString(args, "hi $v. Cost: $12.32 from $e."); - STRCMP_EQUAL("hi bob. Cost: $12.32 from doug.", StatementExecutor_Call(statementExecutor, "test_slim", "echo", args)) -} - -TEST(StatementExecutor, canHandlestringWithJustADollarSign) -{ - StatementExecutor_SetSymbol(statementExecutor, "v2", "bob"); - SlimList_AddString(args, "$"); - STRCMP_EQUAL("$", StatementExecutor_Call(statementExecutor, "test_slim", "echo", args)) -} - -TEST(StatementExecutor, canHandleDollarSignAtTheEndOfTheString) -{ - StatementExecutor_SetSymbol(statementExecutor, "v2", "doug"); - SlimList_AddString(args, "hi $v2$"); - STRCMP_EQUAL("hi doug$", StatementExecutor_Call(statementExecutor, "test_slim", "echo", args)) -} - -TEST(StatementExecutor, canReplaceSymbolsInSubLists) -{ - StatementExecutor_SetSymbol(statementExecutor, "v2", "doug"); - SlimList* subList = SlimList_Create(); - SlimList_AddString(subList, "Hi $v2."); - SlimList_AddList(args, subList); - char* result = StatementExecutor_Call(statementExecutor, "test_slim", "echo", args); - CHECK(result != NULL); - SlimList* returnedList = SlimList_Deserialize(result); - CHECK(NULL != returnedList); - LONGS_EQUAL(1, SlimList_GetLength(returnedList)); - char* element = SlimList_GetStringAt(returnedList, 0); - STRCMP_EQUAL("Hi doug.", element); - SlimList_Destroy(subList); - SlimList_Destroy(returnedList); -} - -TEST(StatementExecutor, canReplaceSymbolsInSubSubLists) -{ - StatementExecutor_SetSymbol(statementExecutor, "v2", "doug"); - SlimList* subList = SlimList_Create(); - SlimList* subSubList = SlimList_Create(); - SlimList_AddString(subSubList, "Hi $v2."); - SlimList_AddList(subList, subSubList); - SlimList_AddList(args, subList); - char* result = StatementExecutor_Call(statementExecutor, "test_slim", "echo", args); - CHECK(result != NULL); - SlimList* returnedSubList = SlimList_Deserialize(result); - CHECK(NULL != returnedSubList); - LONGS_EQUAL(1, SlimList_GetLength(returnedSubList)); - SlimList* returnedSubSubList = SlimList_GetListAt(returnedSubList, 0); - CHECK(NULL != returnedSubSubList); - LONGS_EQUAL(1, SlimList_GetLength(returnedSubSubList)); - char* element = SlimList_GetStringAt(returnedSubSubList, 0); - CHECK(NULL != element); - STRCMP_EQUAL("Hi doug.", element); - SlimList_Destroy(subSubList); - SlimList_Destroy(subList); - SlimList_Destroy(returnedSubList); -} - -TEST(StatementExecutor, canCreateFixtureWithArguments) -{ - SlimList* constructionArgs = SlimList_Create(); - SlimList_AddString(constructionArgs, "hi"); - StatementExecutor_Make(statementExecutor, "test_slim", "TestSlim", constructionArgs); - char* result = StatementExecutor_Call(statementExecutor, "test_slim", "getConstructionArg", empty); - STRCMP_EQUAL("hi", result); - - SlimList_Destroy(constructionArgs); -} - -TEST(StatementExecutor, canCreateFixtureWithArgumentsThatHaveSymbols) -{ - StatementExecutor_SetSymbol(statementExecutor, "name", "doug"); - SlimList* constructionArgs = SlimList_Create(); - SlimList_AddString(constructionArgs, "hi $name"); - StatementExecutor_Make(statementExecutor, "test_slim", "TestSlim", constructionArgs); - char* result = StatementExecutor_Call(statementExecutor, "test_slim", "getConstructionArg", empty); - STRCMP_EQUAL("hi doug", result); - - SlimList_Destroy(constructionArgs); -} - -TEST(StatementExecutor, canCreateFixtureWithArgumentsThatHaveMultipleSymbols) -{ - StatementExecutor_SetSymbol(statementExecutor, "fname", "doug"); - StatementExecutor_SetSymbol(statementExecutor, "lname", "bradbury"); - - SlimList* constructionArgs = SlimList_Create(); - SlimList_AddString(constructionArgs, "hi $fname $lname"); - StatementExecutor_Make(statementExecutor, "test_slim", "TestSlim", constructionArgs); - char* result = StatementExecutor_Call(statementExecutor, "test_slim", "getConstructionArg", empty); - STRCMP_EQUAL("hi doug bradbury", result); - - SlimList_Destroy(constructionArgs); -} - -TEST(StatementExecutor, fixtureConstructionFailsWithUserErrorMessage) -{ - SlimList* constructionArgs = SlimList_Create(); - SlimList_AddString(constructionArgs, "hi doug"); - SlimList_AddString(constructionArgs, "ho doug"); - - char* result = StatementExecutor_Make(statementExecutor, "test_slim", "TestSlim", constructionArgs); - STRCMP_EQUAL("__EXCEPTION__:message:<>", result); - - SlimList_Destroy(constructionArgs); -} - -TEST(StatementExecutor, fixtureCanReturnError) -{ - char* result = StatementExecutor_Call(statementExecutor, "test_slim", "returnError", args); - STRCMP_EQUAL("__EXCEPTION__:message:<>", result); -} - -TEST(StatementExecutor, canCallFixtureDeclaredBackwards) -{ - StatementExecutor_Make(statementExecutor, "backwardsTestSlim", "TestSlimDeclaredLate", empty); - SlimList_AddString(args, "hi doug"); - char* result = StatementExecutor_Call(statementExecutor, "backwardsTestSlim", "echo", args); - STRCMP_EQUAL("hi doug", result); -} - -TEST(StatementExecutor, canCallFixtureNotDeclared) -{ - StatementExecutor_Make(statementExecutor, "undeclaredTestSlim", "TestSlimUndeclared", empty); - SlimList_AddString(args, "hi doug"); - char* result = StatementExecutor_Call(statementExecutor, "undeclaredTestSlim", "echo", args); - STRCMP_EQUAL("hi doug", result); -} - -TEST(StatementExecutor, canHaveNullResult) -{ - char* result = StatementExecutor_Call(statementExecutor, "test_slim", "null", args); - POINTERS_EQUAL(0, result); -} diff --git a/tests/CSlim/SymbolTableTest.cpp b/tests/CSlim/SymbolTableTest.cpp deleted file mode 100644 index 8a834d9..0000000 --- a/tests/CSlim/SymbolTableTest.cpp +++ /dev/null @@ -1,45 +0,0 @@ -#include "CppUTest/TestHarness.h" -#include - -extern "C" -{ -#include "SymbolTable.h" -} - -TEST_GROUP(SymbolTable) -{ - SymbolTable* symbolTable; - - void setup() - { - symbolTable = SymbolTable_Create(); - } - - void teardown() - { - SymbolTable_Destroy(symbolTable); - } -}; - -TEST(SymbolTable, findNonExistentSymbolShouldReturnNull) -{ - POINTERS_EQUAL(NULL, SymbolTable_FindSymbol(symbolTable, "Hey", 3)); -} - -TEST(SymbolTable, findSymbolShouldReturnSymbol) -{ - SymbolTable_SetSymbol(symbolTable, "Hey", "You"); - STRCMP_EQUAL("You", SymbolTable_FindSymbol(symbolTable, "Hey", 3)); -} - -TEST(SymbolTable, CanGetLengthOfSymbol) -{ - SymbolTable_SetSymbol(symbolTable, "Hey", "1234567890"); - LONGS_EQUAL(10, SymbolTable_GetSymbolLength(symbolTable, "Hey", 3)); -} - -TEST(SymbolTable, CanGetLengthOfNonExistentSymbol) -{ - LONGS_EQUAL(-1, SymbolTable_GetSymbolLength(symbolTable, "Hey", 3)); -} - diff --git a/tests/CSlim/TestSlim.c b/tests/CSlim/TestSlim.c deleted file mode 100644 index 660b7e3..0000000 --- a/tests/CSlim/TestSlim.c +++ /dev/null @@ -1,108 +0,0 @@ -#include "TestSlim.h" -#include -#include -#include - -//static local variables -struct TestSlim -{ - int noArgsCalled; - char* arg; - char constructionArg[50]; - char echoBuf[50]; -}; - -void* TestSlim_Create(StatementExecutor* executor, SlimList* args) -{ - if (SlimList_GetLength(args) > 1) { - StatementExecutor_ConstructorError(executor, "xxx"); - return NULL; - } - - TestSlim* self = (TestSlim*)malloc(sizeof(TestSlim)); - memset(self, 0, sizeof(TestSlim)); - - if (SlimList_GetLength(args) == 1) - strncpy(self->constructionArg, SlimList_GetStringAt(args, 0), 50); - - return self; -} - -void TestSlim_Destroy(void* self) -{ - free(self); -} - -int TestSlim_noArgsCalled(TestSlim* executor) { - return executor->noArgsCalled; -} - -static char* noArgs(void* self, SlimList* args) { - TestSlim* me = (TestSlim*)self; - me->noArgsCalled = 1; - return "/__VOID__/"; -} - -static char* returnValue(void* self, SlimList* args) { - return "value"; -} - -static char* oneArg(void* self, SlimList* args) { - char * value = SlimList_GetStringAt(args, 0); - return value; -} - -static char* add(void* self, SlimList* args) { - static char buf[50]; - snprintf(buf, 50, "%s%s", SlimList_GetStringAt(args, 0), SlimList_GetStringAt(args, 1)); - return buf; -} - -static char* null(void* self, SlimList* args) { - return NULL; -} - -static char* setArg(void* self, SlimList* args) { - TestSlim* me = (TestSlim*)self; - me->arg = SlimList_GetStringAt(args, 0); - return "/__VOID__/"; -} - -static char* getArg(void* self, SlimList* args) { - TestSlim* me = (TestSlim*)self; - return me->arg; -} - -static char* getConstructionArg(void* self, SlimList* args) { - TestSlim* me = (TestSlim*)self; - return me->constructionArg; -} - -static char* returnError(void* self, SlimList* args) { - return StatementExecutor_FixtureError("my exception"); -} - -void TestSlim_Register(StatementExecutor* executor) -{ - StatementExecutor_RegisterFixture(executor, "TestSlim", TestSlim_Create, TestSlim_Destroy); - StatementExecutor_RegisterMethod(executor, "TestSlim", "returnValue", returnValue); - StatementExecutor_RegisterMethod(executor, "TestSlim", "noArgs", noArgs); - StatementExecutor_RegisterMethod(executor, "TestSlim", "echo", oneArg); - StatementExecutor_RegisterMethod(executor, "TestSlim", "add", add); - StatementExecutor_RegisterMethod(executor, "TestSlim", "null", null); - StatementExecutor_RegisterMethod(executor, "TestSlim", "setArg", setArg); - StatementExecutor_RegisterMethod(executor, "TestSlim", "getArg", getArg); - StatementExecutor_RegisterMethod(executor, "TestSlim", "getConstructionArg", getConstructionArg); - StatementExecutor_RegisterMethod(executor, "TestSlim", "returnError", returnError); - - - StatementExecutor_RegisterFixture(executor, "TestSlimAgain", TestSlim_Create, TestSlim_Destroy); - StatementExecutor_RegisterMethod(executor, "TestSlimAgain", "setArgAgain", setArg); - StatementExecutor_RegisterMethod(executor, "TestSlimAgain", "getArgAgain", getArg); - - StatementExecutor_RegisterMethod(executor, "TestSlimDeclaredLate", "echo", oneArg); - StatementExecutor_RegisterFixture(executor, "TestSlimDeclaredLate", TestSlim_Create, TestSlim_Destroy); - - StatementExecutor_RegisterMethod(executor, "TestSlimUndeclared", "echo", oneArg); -} - diff --git a/tests/CSlim/TestSlim.h b/tests/CSlim/TestSlim.h deleted file mode 100644 index 35d19d4..0000000 --- a/tests/CSlim/TestSlim.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef D_TestSlim_H -#define D_TestSlim_H - -/////////////////////////////////////////////////////////////////////////////// -// -// TestSlim is responsible for ... -// -/////////////////////////////////////////////////////////////////////////////// -typedef struct TestSlim TestSlim; -#include "StatementExecutor.h" -// #include "SlimList.h" - -void* TestSlim_Create(StatementExecutor* executor, SlimList* args); -void TestSlim_Destroy(void*); -void TestSlim_Register(StatementExecutor*); - -int TestSlim_noArgsCalled(TestSlim* executor); -#endif // D_TestSlim_H diff --git a/tests/Com/TcpComLinkTest.cpp b/tests/Com/TcpComLinkTest.cpp deleted file mode 100644 index ef9c8df..0000000 --- a/tests/Com/TcpComLinkTest.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include "CppUTest/TestHarness.h" - -extern "C" -{ - #include "TcpComLink.h" -} - -TEST_GROUP(TcpComLink) -{ - TcpComLink* tcpComLink; - - void setup() - { - tcpComLink = TcpComLink_Create(0); - } - - void teardown() - { - TcpComLink_Destroy(tcpComLink); - } -}; - -TEST(TcpComLink, Create) -{ -} - diff --git a/tests/ObjectiveC/StatementExecutorSpec.m b/tests/ObjectiveC/StatementExecutorSpec.m deleted file mode 100644 index 3649305..0000000 --- a/tests/ObjectiveC/StatementExecutorSpec.m +++ /dev/null @@ -1,323 +0,0 @@ -#import "OCDSpec/OCDSpec.h" -#import "StatementExecutor.h" -#import "TestSlim.h" - -CONTEXT(StatementExecutor) -{ - __block SlimList* empty; - __block SlimList* args; - __block StatementExecutor* statementExecutor; - - describe(@"slim class", - beforeEach( - ^{ - empty = SlimList_Create(); - args = SlimList_Create(); - statementExecutor = StatementExecutor_Create(); - }), - it(@"makes an instance of a class with no arguments", - ^{ - StatementExecutor_Make(statementExecutor, "test_slim", "TestSlim", empty); - id test_slim_instance = StatementExecutor_Instance(statementExecutor, "test_slim"); - - bool isTestSlimClass = [test_slim_instance isKindOfClass: [TestSlim class]]; - expectTruth(isTestSlimClass); - }), - it(@"makes an instance of a class with 1 argument", - ^{ - SlimList_AddString(args, "starting param"); - StatementExecutor_Make(statementExecutor, "test_slim", "TestSlim", args); - TestSlim* test_slim_instance = (TestSlim*)StatementExecutor_Instance(statementExecutor, "test_slim"); - - [expect(test_slim_instance.calledWithStringArg) toBeEqualTo: @"starting param"]; - }), - it(@"makes an instance of a class with 2 arguments", - ^{ - SlimList_AddString(args, "first param"); - SlimList_AddString(args, "second param"); - StatementExecutor_Make(statementExecutor, "test_slim", "TestSlim", args); - TestSlim* test_slim_instance = (TestSlim*)StatementExecutor_Instance(statementExecutor, "test_slim"); - - [expect(test_slim_instance.calledWithFirstStringArg) toBeEqualTo: @"first param"]; - [expect(test_slim_instance.calledWithSecondStringArg) toBeEqualTo: @"second param"]; - }), - it(@"makes an instance of a class with a symbol in a class name", - ^{ - StatementExecutor_SetSymbol(statementExecutor, "part", "Test"); - StatementExecutor_Make(statementExecutor, "test_slim", "$partSlim", args); - TestSlim* test_slim_instance = (TestSlim*)StatementExecutor_Instance(statementExecutor, "test_slim"); - bool isTestSlimClass = [test_slim_instance isKindOfClass: [TestSlim class]]; - expectTruth(isTestSlimClass); - }), -// it(@"returns an error if the wrong number of arguments is passed for make (1 for 0)", -// ^{ -// SlimList* args = SlimList_Create(); -// SlimList_AddString(args, "starting param"); -// StatementExecutor* statementExecutor = StatementExecutor_Create(); -// -// NSString* result = [NSString stringWithFormat: @"%s", StatementExecutor_Make(statementExecutor, "test_slim", "TestSlimTwo", args)]; -// -// [expect(result) toBeEqualTo: @"__EXCEPTION__:message:<>"]; -// }), - it(@"makes a different instance of the same class", - ^{ - StatementExecutor_Make(statementExecutor, "test_slim", "TestSlim", empty); - StatementExecutor_Make(statementExecutor, "test_slim_2", "TestSlim", empty); - TestSlim* test_slim_instance = (TestSlim*)StatementExecutor_Instance(statementExecutor, "test_slim"); - TestSlim* test_slim_instance_2 = (TestSlim*)StatementExecutor_Instance(statementExecutor, "test_slim_2"); - StatementExecutor_Call(statementExecutor, "test_slim", "noArgs", args); - - expectTruth(test_slim_instance.wasNoArgsCalled); - expectFalse(test_slim_instance_2.wasNoArgsCalled); - }), - it(@"removes an instance when failing to create one of a different name", - ^{ - StatementExecutor_Make(statementExecutor, "test_slim", "TestSlim", empty); - StatementExecutor_Make(statementExecutor, "test_slim", "NoSuchClass", empty); - - id test_slim_instance = StatementExecutor_Instance(statementExecutor, "test_slim"); - - expectTruth(test_slim_instance == NULL); - }), - it(@"returns an error if the instance does not exists", - ^{ - NSString* result = [NSString stringWithFormat: @"%s", StatementExecutor_Call(statementExecutor, "missing_instance", "anyMethod", empty)]; - - [expect(result) toBeEqualTo: @"__EXCEPTION__:message:<>"]; - // snprintf(errorMessage, 128, "%s", [[NSString stringWithFormat: @"__EXCEPTION__:message:<>", instanceName] UTF8String]); - }), - it(@"calls a function with no args", - ^{ - StatementExecutor_Make(statementExecutor, "test_slim", "TestSlim", empty); - StatementExecutor_Call(statementExecutor, "test_slim", "noArgs", args); - - TestSlim* test_slim_instance = (TestSlim*)StatementExecutor_Instance(statementExecutor, "test_slim"); - expectTruth(test_slim_instance.wasNoArgsCalled); - }), - it(@"returns what the method that takes no arguments returns", - ^{ - StatementExecutor_Make(statementExecutor, "test_slim", "TestSlim", empty); - TestSlim* test_slim_instance = (TestSlim*)StatementExecutor_Instance(statementExecutor, "test_slim"); - - NSString* result = [NSString stringWithFormat: @"%s", StatementExecutor_Call(statementExecutor, "test_slim", "noArgs", args)]; - - [expect(result) toBeEqualTo: [test_slim_instance noArgs]]; - }), - it(@"returns an error if the function with no arguments does not exist", - ^{ - StatementExecutor_Make(statementExecutor, "test_slim", "TestSlim", empty); - NSString* result = [NSString stringWithFormat: @"%s", StatementExecutor_Call(statementExecutor, "test_slim", "noSuchMethod", args)]; - - [expect(result) toBeEqualTo: @"__EXCEPTION__:message:<>"]; - }), - it(@"returns an error if calling a method with one agument, but it takes none", - ^{ - SlimList_AddString(args, "first"); - StatementExecutor_Make(statementExecutor, "test_slim", "TestSlim", empty); - StatementExecutor_Call(statementExecutor, "test_slim", "withStringArg", args); - - NSString* result = [NSString stringWithFormat: @"%s", StatementExecutor_Call(statementExecutor, "test_slim", "noSuchMethod", args)]; - [expect(result) toBeEqualTo: @"__EXCEPTION__:message:<>"]; - }), - it(@"calls a function with a string argument", - ^{ - SlimList_AddString(args, "put the toilet seat down"); - StatementExecutor_Make(statementExecutor, "test_slim", "TestSlim", empty); - StatementExecutor_Call(statementExecutor, "test_slim", "withStringArg", args); - - TestSlim* test_slim_instance = (TestSlim*)StatementExecutor_Instance(statementExecutor, "test_slim"); - [expect(test_slim_instance.calledWithStringArg) toBeEqualTo:@"put the toilet seat down"]; - }), - it(@"calls a function with an nsnumber argument", - ^{ - SlimList_AddString(args, "123.45"); - StatementExecutor_Make(statementExecutor, "test_slim", "TestSlim", empty); - StatementExecutor_Call(statementExecutor, "test_slim", "withNSNumberArg", args); - - TestSlim* test_slim_instance = (TestSlim*)StatementExecutor_Instance(statementExecutor, "test_slim"); - expectTruth(123.45 == [test_slim_instance.calledWithNSNumberArg doubleValue]); - }), - it(@"returns an error if the function with one argument does not exist", - ^{ - SlimList_AddString(args, "put the toilet seat down"); - StatementExecutor_Make(statementExecutor, "test_slim", "TestSlim", empty); - NSString* result = [NSString stringWithFormat: @"%s", StatementExecutor_Call(statementExecutor, "test_slim", "noOtherSuchMethod", args)]; - - [expect(result) toBeEqualTo: @"__EXCEPTION__:message:<>"]; - }), - it(@"calls a method with null if no arguments are given, but it takes one", - ^{ - StatementExecutor_Make(statementExecutor, "test_slim", "TestSlim", empty); - StatementExecutor_Call(statementExecutor, "test_slim", "withStringArg", args); - - TestSlim* test_slim_instance = (TestSlim*)StatementExecutor_Instance(statementExecutor, "test_slim"); - expectTruth(test_slim_instance.calledWithStringArg == NULL); - }), - it(@"calls a function with two string arguments", - ^{ - SlimList_AddString(args, "put the toilet seat down"); - SlimList_AddString(args, "every time"); - StatementExecutor_Make(statementExecutor, "test_slim", "TestSlim", empty); - StatementExecutor_Call(statementExecutor, "test_slim", "withMultipleArgs", args); - - TestSlim* test_slim_instance = (TestSlim*)StatementExecutor_Instance(statementExecutor, "test_slim"); - [expect(test_slim_instance.calledWithFirstStringArg) toBeEqualTo:@"put the toilet seat down"]; - [expect(test_slim_instance.calledWithSecondStringArg) toBeEqualTo:@"every time"]; - }), - it(@"returns an error if the class is missing", - ^{ - NSString* result = [NSString stringWithFormat: @"%s", StatementExecutor_Make(statementExecutor, "test_slim", "NoSuchClass", empty)]; - [expect(result) toBeEqualTo: @"__EXCEPTION__:message:<>"]; - }), - it(@"returns the return value of the called method with one argument", - ^{ - SlimList_AddString(args, "call with and return this"); - - StatementExecutor* statementExecutor = StatementExecutor_Create(); - StatementExecutor_Make(statementExecutor, "test_slim", "TestSlim", empty); - - NSString* result = [NSString stringWithFormat: @"%s", StatementExecutor_Call(statementExecutor, "test_slim", "withStringArg", args)]; - [expect(result) toBeEqualTo: @"return value for one string"]; - }), - it(@"returns the return value of the called method with multiple arguments", - ^{ - SlimList_AddString(args, "first"); - SlimList_AddString(args, "second"); - - StatementExecutor* statementExecutor = StatementExecutor_Create(); - StatementExecutor_Make(statementExecutor, "test_slim", "TestSlim", empty); - - NSString* result = [NSString stringWithFormat: @"%s", StatementExecutor_Call(statementExecutor, "test_slim", "withMultipleArgs", args)]; - [expect(result) toBeEqualTo: @"return value for multiple strings"]; - }), - it(@"replaces a symbol with it's value", - ^{ - SlimList_AddString(args, "hello $v"); - StatementExecutor_SetSymbol(statementExecutor, "v", "bob"); - StatementExecutor_Make(statementExecutor, "test_slim", "TestSlim", empty); - StatementExecutor_Call(statementExecutor, "test_slim", "withStringArg", args); - - TestSlim* test_slim_instance = (TestSlim*)StatementExecutor_Instance(statementExecutor, "test_slim"); - [expect(test_slim_instance.calledWithStringArg) toBeEqualTo:@"hello bob"]; - }), - it(@"replaces a symbol in the middle", - ^{ - SlimList_AddString(args, "hello $v person"); - StatementExecutor_SetSymbol(statementExecutor, "v", "eric"); - StatementExecutor_Make(statementExecutor, "test_slim", "TestSlim", empty); - StatementExecutor_Call(statementExecutor, "test_slim", "withStringArg", args); - - TestSlim* test_slim_instance = (TestSlim*)StatementExecutor_Instance(statementExecutor, "test_slim"); - [expect(test_slim_instance.calledWithStringArg) toBeEqualTo:@"hello eric person"]; - }), - it(@"replaces a symbol with other non-alphanumeric", - ^{ - SlimList_AddString(args, "$v=why"); - StatementExecutor_SetSymbol(statementExecutor, "v", "jim"); - StatementExecutor_Make(statementExecutor, "test_slim", "TestSlim", empty); - StatementExecutor_Call(statementExecutor, "test_slim", "withStringArg", args); - - TestSlim* test_slim_instance = (TestSlim*)StatementExecutor_Instance(statementExecutor, "test_slim"); - [expect(test_slim_instance.calledWithStringArg) toBeEqualTo:@"jim=why"]; - }), - it(@"replaces multiple different symbols", - ^{ - SlimList_AddString(args, "hi $v. Cost: $12.32 from $e."); - StatementExecutor_SetSymbol(statementExecutor, "v", "bob"); - StatementExecutor_SetSymbol(statementExecutor, "e", "doug"); - StatementExecutor_Make(statementExecutor, "test_slim", "TestSlim", empty); - StatementExecutor_Call(statementExecutor, "test_slim", "withStringArg", args); - - TestSlim* test_slim_instance = (TestSlim*)StatementExecutor_Instance(statementExecutor, "test_slim"); - [expect(test_slim_instance.calledWithStringArg) toBeEqualTo:@"hi bob. Cost: $12.32 from doug."]; - }), - it(@"does not replace a single dollar sign", - ^{ - SlimList_AddString(args, "$"); - StatementExecutor_SetSymbol(statementExecutor, "v", "bob"); - StatementExecutor_Make(statementExecutor, "test_slim", "TestSlim", empty); - StatementExecutor_Call(statementExecutor, "test_slim", "withStringArg", args); - - TestSlim* test_slim_instance = (TestSlim*)StatementExecutor_Instance(statementExecutor, "test_slim"); - [expect(test_slim_instance.calledWithStringArg) toBeEqualTo:@"$"]; - }), - it(@"does not replace a dollar sign at the end of the string", - ^{ - SlimList_AddString(args, "hi $v$"); - StatementExecutor* statementExecutor = StatementExecutor_Create(); - StatementExecutor_SetSymbol(statementExecutor, "v", "bob"); - StatementExecutor_Make(statementExecutor, "test_slim", "TestSlim", empty); - StatementExecutor_Call(statementExecutor, "test_slim", "withStringArg", args); - - TestSlim* test_slim_instance = (TestSlim*)StatementExecutor_Instance(statementExecutor, "test_slim"); - [expect(test_slim_instance.calledWithStringArg) toBeEqualTo:@"hi bob$"]; - }), - it(@"replaces a symbol in a sublist", - ^{ - - }), - it(@"creates an instance with one arg while replacing a symbol", - ^{ - SlimList_AddString(args, "hello $person"); - StatementExecutor_SetSymbol(statementExecutor, "person", "bob"); - StatementExecutor_Make(statementExecutor, "test_slim", "TestSlim", args); - TestSlim* test_slim_instance = (TestSlim*)StatementExecutor_Instance(statementExecutor, "test_slim"); - - [expect(test_slim_instance.calledWithStringArg) toBeEqualTo: @"hello bob"]; - }), - it(@"creates an instance with one arg while replacing two symbols", - ^{ - SlimList_AddString(args, "hello $person $animal"); - StatementExecutor_SetSymbol(statementExecutor, "person", "bob"); - StatementExecutor_SetSymbol(statementExecutor, "animal", "dog"); - StatementExecutor_Make(statementExecutor, "test_slim", "TestSlim", args); - TestSlim* test_slim_instance = (TestSlim*)StatementExecutor_Instance(statementExecutor, "test_slim"); - - [expect(test_slim_instance.calledWithStringArg) toBeEqualTo: @"hello bob dog"]; - }), - it(@"creates an instance with two args while replacing two symbols", - ^{ - SlimList_AddString(args, "hello $person $animal"); - SlimList_AddString(args, "hello $animal"); - StatementExecutor_SetSymbol(statementExecutor, "person", "bob"); - StatementExecutor_SetSymbol(statementExecutor, "animal", "dog"); - StatementExecutor_Make(statementExecutor, "test_slim", "TestSlim", args); - TestSlim* test_slim_instance = (TestSlim*)StatementExecutor_Instance(statementExecutor, "test_slim"); - - [expect(test_slim_instance.calledWithFirstStringArg) toBeEqualTo: @"hello bob dog"]; - [expect(test_slim_instance.calledWithSecondStringArg) toBeEqualTo: @"hello dog"]; - }), - it(@"returns OK when calling a method with return type of void", - ^{ - StatementExecutor_Make(statementExecutor, "test_slim", "TestSlim", args); - NSString* result = [NSString stringWithUTF8String: StatementExecutor_Call(statementExecutor, "test_slim", "withVoidReturnType", args)]; - - [expect(result) toBeEqualTo: @"OK"]; - }), - it(@"converts an int to a string when returning", - ^{ - SlimList_AddString(args, "123"); - StatementExecutor_Make(statementExecutor, "test_slim", "TestSlim", args); - NSString* result = [NSString stringWithUTF8String: StatementExecutor_Call(statementExecutor, "test_slim", "withIntPassThrough", args)]; - - [expect(result) toBeEqualTo: @"123"]; - }), - it(@"converts an NSNumber to a string when returning", - ^{ - StatementExecutor_Make(statementExecutor, "test_slim", "TestSlim", args); - NSString* result = [NSString stringWithUTF8String: StatementExecutor_Call(statementExecutor, "test_slim", "returnsNSNumber", args)]; - TestSlim* test_slim_instance = (TestSlim*)StatementExecutor_Instance(statementExecutor, "test_slim"); - [expect(result) toBeEqualTo: [[test_slim_instance returnsNSNumber] stringValue]]; - }), -// it(@"mvkdn", -// ^{ -// SlimList* args = SlimList_Create(); -// SlimList_AddString(args, "Köln"); -// StatementExecutor* statementExecutor = StatementExecutor_Create(); -// StatementExecutor_Make(statementExecutor, "test_slim", "TestSlim", args); -// TestSlim* test_slim_instance = (TestSlim*)StatementExecutor_Instance(statementExecutor, "test_slim"); -// -// [expect(test_slim_instance.calledWithStringArg) toBeEqualTo: @"Köln"]; -// }), - nil); -} \ No newline at end of file diff --git a/tests/ObjectiveC/TestSlim.h b/tests/ObjectiveC/TestSlim.h deleted file mode 100644 index df3d247..0000000 --- a/tests/ObjectiveC/TestSlim.h +++ /dev/null @@ -1,25 +0,0 @@ -#import - -@interface TestSlim : NSObject { - BOOL wasNoArgsCalled; - NSString* calledWithStringArg; - NSNumber* calledWithNSNumberArg; -} -@property (assign) BOOL wasNoArgsCalled; -@property (nonatomic, retain) NSString* calledWithStringArg; -@property (nonatomic, retain) NSNumber* calledWithNSNumberArg; -@property (nonatomic, retain) NSString* calledWithFirstStringArg; -@property (nonatomic, retain) NSString* calledWithSecondStringArg; - --(id) initWithString: (NSString*) givenString; --(id) initWithArray: (NSArray*) givenArray; - --(NSString*) noArgs; --(NSString*) withStringArg:(NSString*) someString; --(void) withNSNumberArg:(NSNumber*) someNSNumber; --(NSString*) withMultipleArgs:(NSArray*) args; --(NSString*) createTestSlimWithString: (NSString*) givenString; - --(NSNumber*) returnsNSNumber; - -@end diff --git a/tests/ObjectiveC/TestSlim.m b/tests/ObjectiveC/TestSlim.m deleted file mode 100644 index 6a492aa..0000000 --- a/tests/ObjectiveC/TestSlim.m +++ /dev/null @@ -1,80 +0,0 @@ -#import "TestSlim.h" - -@implementation TestSlim - -@synthesize wasNoArgsCalled, calledWithStringArg, calledWithNSNumberArg; -@synthesize calledWithFirstStringArg, calledWithSecondStringArg; - --(id) initWithString: (NSString*) givenString { - if ((self = [super init])) { - self.calledWithStringArg = givenString; - } - return self; -} --(id) initWithArray: (NSArray*) givenArray { - if ((self = [super init])) { - self.calledWithFirstStringArg = [givenArray objectAtIndex: 0]; - self.calledWithSecondStringArg = [givenArray objectAtIndex: 1]; - } - return self; -} - --(NSString*) noArgs { - self.wasNoArgsCalled = YES; - return @"return value"; -} - --(void) withVoidReturnType { - //Do nothing -} --(int) withIntPassThrough:(NSString*) givenString { - return [givenString intValue]; -} - --(void) setString: (NSString*) string { - self.calledWithStringArg = string; -} --(NSString*) getStringArg { - return self.calledWithStringArg; -} - --(NSString*) echoBoolean: (NSString*) string { - return string; -} --(NSString*) withStringArg:(NSString*) someString { - self.calledWithStringArg = someString; - return @"return value for one string"; -} - --(void) withNSNumberArg:(NSNumber*) someNSNumber { - self.calledWithNSNumberArg = someNSNumber; -} - --(NSString*) withMultipleArgs:(NSArray*) args { - self.calledWithFirstStringArg = [args objectAtIndex: 0]; - self.calledWithSecondStringArg = [args objectAtIndex: 1]; - return @"return value for multiple strings"; -} - --(NSString*) createTestSlimWithString: (NSString*) givenString { - return givenString; -} - --(NSString*) getFixture { - return @"foo"; -} - --(NSNumber*) returnsNSNumber { - return [NSNumber numberWithInt: 123]; -} - --(void) dealloc { - [calledWithStringArg release]; - [calledWithFirstStringArg release]; - [calledWithSecondStringArg release]; - [super dealloc]; -} - - - -@end diff --git a/tests/ObjectiveC/TestSlimTwo.h b/tests/ObjectiveC/TestSlimTwo.h deleted file mode 100644 index 14ad743..0000000 --- a/tests/ObjectiveC/TestSlimTwo.h +++ /dev/null @@ -1,7 +0,0 @@ -#import - -@interface TestSlimTwo : NSObject { - -} - -@end diff --git a/tests/ObjectiveC/TestSlimTwo.m b/tests/ObjectiveC/TestSlimTwo.m deleted file mode 100644 index c50cced..0000000 --- a/tests/ObjectiveC/TestSlimTwo.m +++ /dev/null @@ -1,5 +0,0 @@ -#import "TestSlimTwo.h" - -@implementation TestSlimTwo - -@end