Skip to content

Commit

Permalink
Added project with tests for available programs. fixed #1
Browse files Browse the repository at this point in the history
Added submodule "CSharp-Minifier". fixed #2
Fixed RemoveSpacesInSource with CSharp-Minifier.
  • Loading branch information
KvanTTT committed Dec 13, 2013
1 parent f63d994 commit f08acf7
Show file tree
Hide file tree
Showing 22 changed files with 407 additions and 245 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "CSharp-Minifier"]
path = CSharp-Minifier
url = https://github.com/KvanTTT/CSharp-Minifier
1 change: 1 addition & 0 deletions CSharp-Minifier
Submodule CSharp-Minifier added at c2025d
63 changes: 63 additions & 0 deletions FreakySources.Tests/FreakySources.Tests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{13621013-38EF-4EEE-8ABA-B69320A7CE83}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>FreakySources.Tests</RootNamespace>
<AssemblyName>FreakySources.Tests</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="nunit.framework">
<HintPath>..\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="QuineTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SourceChecker\SourceChecker.csproj">
<Project>{cd572e98-9d0e-486c-9a7c-7edb55a9e9b2}</Project>
<Name>SourceChecker</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
36 changes: 36 additions & 0 deletions FreakySources.Tests/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("FreakySources.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FreakySources.Tests")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("2dd41a47-c0c6-40cb-ac66-3a65aab7ea6f")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
58 changes: 58 additions & 0 deletions FreakySources.Tests/QuineTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
using NUnit.Framework;
using SourceChecker;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace FreakySources.Tests
{
[TestFixture]
public class QuineTests
{
[Test]
public void SimpleProgram()
{
string simpleProgram = "class P{static void Main(){}}";
Assert.IsFalse(Checker.Compile(simpleProgram).HasError);
}

[Test]
public void SimpleQuine()
{
string simpleQuine = "class P{static void Main(){var s=\"class P{{static void Main(){{var s={1}{0}{1};System.Console.Write(s,s,'{1}');}}}}\";System.Console.Write(s,s,'\"');}}";
Assert.IsFalse(Checker.CheckQuineProgram(simpleQuine).HasError);
}

[Test]
public void SingleLineCommentPalindrome()
{
string singleLineCommentsPalindrome = "//}}{)(niaM diov citats{P ssalc\r\n\rclass P{static void Main(){}}//";
Assert.IsFalse(Checker.CheckPalindromeProgram(singleLineCommentsPalindrome).HasError);
}

[Test]
public void MultiLineCommentPalindrome()
{
string multiLineCommentsPalindrome = "/**/class P{static void Main(){}};/*/;}}{)(niaM diov citats{P ssalc/**/";
Assert.IsFalse(Checker.CheckPalindromeProgram(multiLineCommentsPalindrome).HasError);
}

[Test]
public void SingleLineCommentPalindromeQuine()
{
string singleLineCommentsPalindromeQuine = Checker.RemoveSpacesInSource(File.ReadAllText(@"..\..\..\SingleCommentsPalindromeQuine\Program.cs"));
singleLineCommentsPalindromeQuine = Checker.PrepareSingleLineCommentsPalindrome(singleLineCommentsPalindromeQuine);
Assert.IsFalse(Checker.CheckPalindromeQuineProgram(singleLineCommentsPalindromeQuine).HasError);
}

[Test]
public void MultiLineCommentPalindromeQuine()
{
string multiLineCommentsPalindromeQuine = Checker.RemoveSpacesInSource(File.ReadAllText("..\\..\\..\\MultiCommentsPalindromeQuine\\Program.cs"));
multiLineCommentsPalindromeQuine = Checker.PrepareMultiLineCommentsPalindrome(multiLineCommentsPalindromeQuine);
Assert.IsFalse(Checker.CheckPalindromeQuineProgram(multiLineCommentsPalindromeQuine).HasError);
}
}
}
12 changes: 12 additions & 0 deletions FreakySources.sln
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SelfPrintingGameOfLife", "SelfPrintingGameOfLife\SelfPrintingGameOfLife.csproj", "{ED534701-5CB8-4FE6-87FF-AA8B2DBFE8D5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FreakySources.Tests", "FreakySources.Tests\FreakySources.Tests.csproj", "{13621013-38EF-4EEE-8ABA-B69320A7CE83}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharpMinifier", "CSharp-Minifier\CSharpMinifier\CSharpMinifier.csproj", "{A26C936C-846B-4165-9574-42C74075D4CD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -43,6 +47,14 @@ Global
{ED534701-5CB8-4FE6-87FF-AA8B2DBFE8D5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ED534701-5CB8-4FE6-87FF-AA8B2DBFE8D5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ED534701-5CB8-4FE6-87FF-AA8B2DBFE8D5}.Release|Any CPU.Build.0 = Release|Any CPU
{13621013-38EF-4EEE-8ABA-B69320A7CE83}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{13621013-38EF-4EEE-8ABA-B69320A7CE83}.Debug|Any CPU.Build.0 = Debug|Any CPU
{13621013-38EF-4EEE-8ABA-B69320A7CE83}.Release|Any CPU.ActiveCfg = Release|Any CPU
{13621013-38EF-4EEE-8ABA-B69320A7CE83}.Release|Any CPU.Build.0 = Release|Any CPU
{A26C936C-846B-4165-9574-42C74075D4CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A26C936C-846B-4165-9574-42C74075D4CD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A26C936C-846B-4165-9574-42C74075D4CD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A26C936C-846B-4165-9574-42C74075D4CD}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
6 changes: 3 additions & 3 deletions MultiCommentsPalindromeQuine/App.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/>
</startup>
</configuration>
</configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MultiCommentsPalindromeQuine</RootNamespace>
<AssemblyName>MultiCommentsPalindromeQuine</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand Down
2 changes: 1 addition & 1 deletion MultiCommentsPalindromeQuine/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class P
{
static void Main()
{
var s = "{2}**/using System;class P{{static void Main(){{var s={1}{0}{1};s=string.Format(s,s,'{1}','{2}');var c = s.ToCharArray();Array.Reverse(c);Console.Write(s+'*'+new string(c));}}}}/";
var s = "{2}**/using System;class P{{static void Main(){{var s={1}{0}{1};s=string.Format(s,s,'{1}','{2}');var c=s.ToCharArray();Array.Reverse(c);Console.Write(s+'*'+new string(c));}}}}/";
s = string.Format(s, s, '"', '/');
var c = s.ToCharArray();
Array.Reverse(c);
Expand Down
6 changes: 3 additions & 3 deletions SelfCompiliedProgram/App.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/>
</startup>
</configuration>
</configuration>
3 changes: 2 additions & 1 deletion SelfCompiliedProgram/SelfCompiliedProgram.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SelfCompiliedProgram</RootNamespace>
<AssemblyName>SelfCompiliedProgram</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand Down
6 changes: 3 additions & 3 deletions SelfPrintingGameOfLife/App.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/>
</startup>
</configuration>
</configuration>
3 changes: 2 additions & 1 deletion SelfPrintingGameOfLife/SelfPrintingGameOfLife.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SelfPrintingGameOfLife</RootNamespace>
<AssemblyName>SelfPrintingGameOfLife</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand Down
6 changes: 3 additions & 3 deletions SingleCommentsPalindromeQuine/App.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/>
</startup>
</configuration>
</configuration>
2 changes: 1 addition & 1 deletion SingleCommentsPalindromeQuine/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class P
{
static void Main()
{
var s = "using System;class P{{static void Main(){{var s={1}{0}{1};s = string.Format(s, s, '{1}', '{2}{2}');var c = s.ToCharArray();Array.Reverse(c);Console.Write(new string(c) + {1}{2}r{2}n{2}r{1} + s);}}}}//";
var s = "using System;class P{{static void Main(){{var s={1}{0}{1};s=string.Format(s,s,'{1}','{2}{2}');var c=s.ToCharArray();Array.Reverse(c);Console.Write(new string(c)+{1}{2}r{2}n{2}r{1}+s);}}}}//";
s = string.Format(s, s, '"', '\\');
var c = s.ToCharArray();
Array.Reverse(c);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SingleCommentsPalindromeQuine</RootNamespace>
<AssemblyName>SingleCommentsPalindromeQuine</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand Down
Loading

0 comments on commit f08acf7

Please sign in to comment.