Moved all sample basic code into samples folder
authorMichael Welch <michaelgwelch@gmail.com>
Wed, 27 Dec 2006 22:33:23 +0000 (22:33 +0000)
committerMichael Welch <michaelgwelch@gmail.com>
Wed, 27 Dec 2006 22:33:23 +0000 (22:33 +0000)
mbasic/mbasic.csproj
samples/ForStatementTest.mbas [moved from mbasic/ForStatementTest.mbas with 100% similarity]
samples/helloworld.mbas [moved from mbasic/helloworld.mbas with 100% similarity]
samples/print.mbas [moved from mbasic/print.mbas with 100% similarity]
samples/secretnum.mbas [moved from mbasic/secretnum.mbas with 100% similarity]
samples/testPrint.py [new file with mode: 0755]

index f5e1b7f..4f62ee7 100644 (file)
     <Compile Include="Variable.cs" />\r
   </ItemGroup>\r
   <ItemGroup>\r
-    <None Include="ForStatementTest.mbas" />\r
-    <None Include="helloworld.mbas" />\r
-    <None Include="print.mbas" />\r
-  </ItemGroup>\r
-  <ItemGroup>\r
     <ProjectReference Include="..\TiBasicRuntime\TiBasicRuntime.csproj">\r
       <Project>{3EF3FB61-5A24-4268-90EC-8FF9101CEF7D}</Project>\r
       <Name>TiBasicRuntime</Name>\r
     </ProjectReference>\r
   </ItemGroup>\r
+  <ItemGroup>\r
+    <None Include="..\samples\ForStatementTest.mbas">\r
+      <Link>samples\ForStatementTest.mbas</Link>\r
+    </None>\r
+    <None Include="..\samples\helloworld.mbas">\r
+      <Link>samples\helloworld.mbas</Link>\r
+    </None>\r
+    <None Include="..\samples\print.mbas">\r
+      <Link>samples\print.mbas</Link>\r
+    </None>\r
+    <None Include="..\samples\secretnum.mbas">\r
+      <Link>samples\secretnum.mbas</Link>\r
+    </None>\r
+    <None Include="..\samples\testPrint.py">\r
+      <Link>samples\testPrint.py</Link>\r
+    </None>\r
+  </ItemGroup>\r
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />\r
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
        Other similar extension points exist, see Microsoft.Common.targets.\r
similarity index 100%
rename from mbasic/print.mbas
rename to samples/print.mbas
similarity index 100%
rename from mbasic/secretnum.mbas
rename to samples/secretnum.mbas
diff --git a/samples/testPrint.py b/samples/testPrint.py
new file mode 100755 (executable)
index 0000000..bd15980
--- /dev/null
@@ -0,0 +1,72 @@
+import clr
+from System import *
+
+lineNumber = 0
+def assertEquals(x):
+       global lineNumber
+       lineNumber = lineNumber + 1
+       input = Console.ReadLine()
+       if x.Equals(input): return
+       Console.WriteLine("Line {0}: '{1}' != '{2}'",lineNumber,x,input)
+
+assertEquals(" 10  20 ")
+
+assertEquals("TI COMPUTER")
+
+assertEquals("HELLO, FRIEND")
+
+assertEquals("HIJOAN")
+
+assertEquals("HI JOAN")
+
+assertEquals("HELLO JOAN")
+
+assertEquals(" 10.2 -30.5  16.7 ")
+assertEquals("-20.3 ")
+
+# Number printing scenarios from II-66 of User's Reference Guide
+assertEquals("-10  7.1 ")
+assertEquals(" 9.34277E+10 ")
+assertEquals(" .0000000001 ")
+assertEquals(" 1.2E-10 ")
+assertEquals(" 2.46E-10 ")
+assertEquals(" 15 -3 ")
+assertEquals(" 3.35 -46.1 ")
+assertEquals(" 791.1234568 ")
+assertEquals("-.0127  .64 ")
+assertEquals(" 1.97853E-10 ")
+assertEquals("-9.877E+22 ")
+assertEquals(" 7.364E+12 ")
+assertEquals(" 1.23659E-14 ")
+assertEquals(" 1.25E-09 -4.36E+13 ")
+assertEquals(" 7.6E+**  8.1E-** ")
+
+# Scenarios from II-67
+assertEquals("A")
+assertEquals("")
+assertEquals("B")
+assertEquals("-26 -33 HELLOHOW ARE YOU?")
+assertEquals("-26 ")
+assertEquals("HELLO")
+assertEquals("HOW ARE YOU?")
+assertEquals("ZONE 1        ZONE 2")
+assertEquals("ZONE 1")
+assertEquals("              ZONE 2")
+assertEquals("ZONE 1")
+
+# Scenarios from II-68
+assertEquals("    HELLO")
+assertEquals("    HELLO")
+assertEquals(" 23.5     48.6 ")
+assertEquals("   23.5 ")
+assertEquals("   48.6 ")
+
+assertEquals(" 326           79 ")
+assertEquals(" 326           79 ")
+assertEquals(" 326          ")
+assertEquals(" 79 ")
+assertEquals("     326 ")
+assertEquals("      79 ")
+assertEquals(" 326           79 ")
+
+Console.WriteLine("done")