Skip to content
Snippets Groups Projects
Commit 51517782 authored by Dmytro Bogatov's avatar Dmytro Bogatov :two_hearts:
Browse files

Merge branch 'run-on-unix' into 'master'

Run on unix

See merge request !1
parents 5b70c7bc a43a6eec
No related branches found
No related tags found
No related merge requests found
Showing
with 94 additions and 336 deletions
# http://editorconfig.org
root = true
[*]
indent_style = tab
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = false
insert_final_newline = true
[*.yml]
indent_style = space
indent_size = 2
......@@ -5,36 +5,3 @@
[Oo]bj/
[Bb]in/
packages/
TestResults/
# globs
Makefile.in
*.DS_Store
*.sln.cache
*.suo
*.cache
*.pidb
*.userprefs
*.usertasks
config.log
config.make
config.status
aclocal.m4
install-sh
autom4te.cache/
*.user
*.tar.gz
tarballs/
test-results/
Thumbs.db
# Mac bundle stuff
*.dmg
*.app
# resharper
*_Resharper.*
*.Resharper
# dotCover
*.dotCover
stages:
- test
test:
stage: test
image: microsoft/dotnet:1.1-sdk-msbuild
script:
- cd test
- dotnet restore
- dotnet test | tee tests.out
- "cat tests.out | grep 'Failed: 0.'"
tags:
- Docker
{
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceRoot}/src/bin/Debug/netcoreapp1.1/coding-interview.dll",
"args": [],
"cwd": "${workspaceRoot}",
"externalConsole": false,
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command.pickProcess}"
}
]
}
\ No newline at end of file
{
"version": "0.1.0",
"command": "dotnet",
"isShellCommand": true,
"args": [],
"tasks": [
{
"taskName": "build",
"args": [
"${workspaceRoot}/src/coding-interview.csproj"
],
"isBuildCommand": true,
"problemMatcher": "$msCompile"
}
]
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{5A684644-EE26-4531-B0B8-A10F3591468C}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>CodingInterview.Tests</RootNamespace>
<AssemblyName>CodingInterview.Tests</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="nunit.framework">
<HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Sort\BubleSortTests.cs" />
<Compile Include="Sort\InsertionSortTests.cs" />
<Compile Include="Sort\SelectionSortTests.cs" />
<Compile Include="Sort\MergeSortTests.cs" />
<Compile Include="Sort\QuickSortTests.cs" />
<Compile Include="Sort\HeapSortTests.cs" />
<Compile Include="CrackingTheCodingInterview\DataStructures\StringCompressionTests.cs" />
<Compile Include="SchoolOlympiads\ChildrenTests.cs" />
<Compile Include="SchoolOlympiads\HanoiTests.cs" />
<Compile Include="SchoolOlympiads\PortalsTests.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="Resources\Portals\01.ans" />
<None Include="Resources\Portals\01.in" />
<None Include="Resources\Portals\02.ans" />
<None Include="Resources\Portals\02.in" />
<None Include="Resources\Portals\03.ans" />
<None Include="Resources\Portals\03.in" />
<None Include="Resources\Portals\04.ans" />
<None Include="Resources\Portals\04.in" />
<None Include="Resources\Portals\05.ans" />
<None Include="Resources\Portals\05.in" />
<None Include="Resources\Portals\06.ans" />
<None Include="Resources\Portals\06.in" />
<None Include="Resources\Portals\07.ans" />
<None Include="Resources\Portals\07.in" />
<None Include="Resources\Portals\08.ans" />
<None Include="Resources\Portals\08.in" />
<None Include="Resources\Portals\09.ans" />
<None Include="Resources\Portals\09.in" />
<None Include="Resources\Portals\10.ans" />
<None Include="Resources\Portals\10.in" />
<None Include="Resources\Portals\11.ans" />
<None Include="Resources\Portals\11.in" />
<None Include="Resources\Portals\12.ans" />
<None Include="Resources\Portals\12.in" />
<None Include="Resources\Portals\13.ans" />
<None Include="Resources\Portals\13.in" />
<None Include="Resources\Portals\14.ans" />
<None Include="Resources\Portals\14.in" />
<None Include="Resources\Portals\15.ans" />
<None Include="Resources\Portals\15.in" />
<None Include="Resources\Portals\16.ans" />
<None Include="Resources\Portals\16.in" />
<None Include="Resources\Portals\17.ans" />
<None Include="Resources\Portals\17.in" />
<None Include="Resources\Portals\18.ans" />
<None Include="Resources\Portals\18.in" />
<None Include="Resources\Portals\19.ans" />
<None Include="Resources\Portals\19.in" />
<None Include="Resources\Portals\20.ans" />
<None Include="Resources\Portals\20.in" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CodingInterview\CodingInterview.csproj">
<Project>{ACE1BD78-6DB9-4D3E-A33D-AE22FFF1C601}</Project>
<Name>CodingInterview</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Sort\" />
<Folder Include="CrackingTheCodingInterview\" />
<Folder Include="CrackingTheCodingInterview\DataStructures\" />
<Folder Include="SchoolOlympiads\" />
<Folder Include="Resources\" />
<Folder Include="Resources\Portals\" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
//
//
// This file - StringCompressionTests.cs was created by Dmytro Bogatov (dmytro@dbogatov.org)
// on 12/7/2016, 3:47 PM
using NUnit.Framework;
namespace CrackingTheCodingInterview.DataStructures
{
[TestFixture]
public class StringCompressionTests
{
[Test]
public void TestCases()
{
StringAssert.AreEqualIgnoringCase("a2b1c5a3", StringCompression.Compress("aabcccccaaa"));
StringAssert.AreEqualIgnoringCase("abcd", StringCompression.Compress("abcd"));
StringAssert.AreEqualIgnoringCase("", StringCompression.Compress(""));
StringAssert.AreEqualIgnoringCase("a", StringCompression.Compress("a"));
StringAssert.AreEqualIgnoringCase("aaabcdefgh", StringCompression.Compress("aaabcdefgh"));
}
}
}
//
//
// This file - ChildrenTests.cs was created by Dmytro Bogatov (dmytro@dbogatov.org)
// on 12/7/2016, 4:18 PM
using System;
using NUnit.Framework;
namespace SchoolOlympiads
{
[TestFixture]
public class ChildrenTests
{
[Test]
public void TestCases()
{
Assert.AreEqual(4, Children.Solve(10, 3));
Assert.AreEqual(5, Children.Solve(10, 2));
Assert.AreEqual(10, Children.Solve(10, 1));
Assert.AreEqual(1, Children.Solve(1, 10));
Assert.AreEqual(1, Children.Solve(2, 10));
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NUnit" version="2.6.4" targetFramework="net45" />
</packages>
\ No newline at end of file
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodingInterview", "CodingInterview\CodingInterview.csproj", "{ACE1BD78-6DB9-4D3E-A33D-AE22FFF1C601}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodingInterview.Tests", "CodingInterview.Tests\CodingInterview.Tests.csproj", "{5A684644-EE26-4531-B0B8-A10F3591468C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{ACE1BD78-6DB9-4D3E-A33D-AE22FFF1C601}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ACE1BD78-6DB9-4D3E-A33D-AE22FFF1C601}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ACE1BD78-6DB9-4D3E-A33D-AE22FFF1C601}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ACE1BD78-6DB9-4D3E-A33D-AE22FFF1C601}.Release|Any CPU.Build.0 = Release|Any CPU
{5A684644-EE26-4531-B0B8-A10F3591468C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5A684644-EE26-4531-B0B8-A10F3591468C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5A684644-EE26-4531-B0B8-A10F3591468C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5A684644-EE26-4531-B0B8-A10F3591468C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{ACE1BD78-6DB9-4D3E-A33D-AE22FFF1C601}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>CodingInterview</RootNamespace>
<AssemblyName>CodingInterview</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Sort\BubbleSort.cs" />
<Compile Include="Sort\InsertionSort.cs" />
<Compile Include="Sort\SelectionSort.cs" />
<Compile Include="Sort\MergeSort.cs" />
<Compile Include="Sort\QuickSort.cs" />
<Compile Include="Sort\HeapSort.cs" />
<Compile Include="CrackingTheCodingInterview\DataStructures\StringCompression.cs" />
<Compile Include="SchoolOlympiads\Children.cs" />
<Compile Include="SchoolOlympiads\Hanoi.cs" />
<Compile Include="SchoolOlympiads\Portals.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="Sort\" />
<Folder Include="CrackingTheCodingInterview\" />
<Folder Include="CrackingTheCodingInterview\DataStructures\" />
<Folder Include="SchoolOlympiads\" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
//
//
// This file - AssemblyInfo.cs was created by Dmytro Bogatov (dmytro@dbogatov.org)
// on 12/6/2016, 7:26 PM
using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("CodingInterview")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion("1.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]
// cSpell Settings
{
// Version of the setting file. Always 0.1
"version": "0.1",
// language - current active spelling language
"language": "en",
// words - list of words to be always considered correct
"words": [
"Heapify"
],
// flagWords - list of words to be always considered incorrect
// This is useful for offensive words and common spelling errors.
// For example "hte" should be "the"
"flagWords": [
"hte"
]
}
\ No newline at end of file
//
//
// This file - StringCompression.cs was created by Dmytro Bogatov (dmytro@dbogatov.org)
// on 12/7/2016, 3:44 PM
/*
/*
* Implement a method to perform basic string compression using the counts of repeated characters.
* For example, the string aabcccccaaa would become a2blc5a3.
* If the "compressed" string would not become smaller than the original string,
* your method should return the original string.
*/
namespace CrackingTheCodingInterview.DataStructures
namespace CodingInterview.Cracking
{
public class StringCompression
{
......
//
//
// This file - Children.cs was created by Dmytro Bogatov (dmytro@dbogatov.org)
// on 12/7/2016, 4:08 PM
namespace SchoolOlympiads
namespace CodingInterview.School
{
public class Children
{
......
//
//
// This file - Hanoi.cs was created by Dmytro Bogatov (dmytro@dbogatov.org)
// on 12/7/2016, 5:50 PM
namespace SchoolOlympiads
namespace CodingInterview.School
{
public class Hanoi
{
......
//
//
// This file - Portals.cs was created by Dmytro Bogatov (dmytro@dbogatov.org)
// on 12/7/2016, 7:39 PM
using System;
using System;
using System.Collections.Generic;
using System.Linq;
namespace SchoolOlympiads
namespace CodingInterview.School
{
public class Portals
{
......
//
//
// This file - BubleSort.cs was created by Dmytro Bogatov (dmytro@dbogatov.org)
// on 12/6/2016, 7:26 PM
namespace Sort
namespace CodingInterview.Sort
{
public class BubleSort
public class BubbleSort
{
public static int[] Sort(int[] input)
{
......
//
//
// This file - HeapSort.cs was created by Dmytro Bogatov (dmytro@dbogatov.org)
// on 12/7/2016, 2:44 PM
namespace Sort
namespace CodingInterview.Sort
{
// Mostly borrowed from https://begeeben.wordpress.com/2012/08/21/heap-sort-in-c/
public class HeapSort
......
//
//
// This file - InsertionSort.cs was created by Dmytro Bogatov (dmytro@dbogatov.org)
// on 12/6/2016, 7:44 PM
namespace Sort
namespace CodingInterview.Sort
{
public class InsertionSort
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment