This repository has been archived by the owner on Dec 17, 2023. It is now read-only.
forked from jsl/ruby_ukanren
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c1db055
commit b7eaab1
Showing
19 changed files
with
884 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
############################################################################### | ||
# Set default behavior to automatically normalize line endings. | ||
############################################################################### | ||
* text=auto | ||
|
||
############################################################################### | ||
# Set default behavior for command prompt diff. | ||
# | ||
# This is need for earlier builds of msysgit that does not have it on by | ||
# default for csharp files. | ||
# Note: This is only used by command line | ||
############################################################################### | ||
#*.cs diff=csharp | ||
|
||
############################################################################### | ||
# Set the merge driver for project and solution files | ||
# | ||
# Merging from the command prompt will add diff markers to the files if there | ||
# are conflicts (Merging from VS is not affected by the settings below, in VS | ||
# the diff markers are never inserted). Diff markers may cause the following | ||
# file extensions to fail to load in VS. An alternative would be to treat | ||
# these files as binary and thus will always conflict and require user | ||
# intervention with every merge. To do so, just uncomment the entries below | ||
############################################################################### | ||
#*.sln merge=binary | ||
#*.csproj merge=binary | ||
#*.vbproj merge=binary | ||
#*.vcxproj merge=binary | ||
#*.vcproj merge=binary | ||
#*.dbproj merge=binary | ||
#*.fsproj merge=binary | ||
#*.lsproj merge=binary | ||
#*.wixproj merge=binary | ||
#*.modelproj merge=binary | ||
#*.sqlproj merge=binary | ||
#*.wwaproj merge=binary | ||
|
||
############################################################################### | ||
# behavior for image files | ||
# | ||
# image files are treated as binary by default. | ||
############################################################################### | ||
#*.jpg binary | ||
#*.png binary | ||
#*.gif binary | ||
|
||
############################################################################### | ||
# diff behavior for common document formats | ||
# | ||
# Convert binary document formats to text before diffing them. This feature | ||
# is only available from the command line. Turn it on by uncommenting the | ||
# entries below. | ||
############################################################################### | ||
#*.doc diff=astextplain | ||
#*.DOC diff=astextplain | ||
#*.docx diff=astextplain | ||
#*.DOCX diff=astextplain | ||
#*.dot diff=astextplain | ||
#*.DOT diff=astextplain | ||
#*.pdf diff=astextplain | ||
#*.PDF diff=astextplain | ||
#*.rtf diff=astextplain | ||
#*.RTF diff=astextplain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,187 @@ | ||
## Ignore Visual Studio temporary files, build results, and | ||
## files generated by popular Visual Studio add-ons. | ||
|
||
# User-specific files | ||
*.suo | ||
*.user | ||
*.sln.docstates | ||
|
||
# Build results | ||
[Dd]ebug/ | ||
[Dd]ebugPublic/ | ||
[Rr]elease/ | ||
[Rr]eleases/ | ||
x64/ | ||
x86/ | ||
build/ | ||
bld/ | ||
[Bb]in/ | ||
[Oo]bj/ | ||
|
||
# Roslyn cache directories | ||
*.ide/ | ||
|
||
# MSTest test Results | ||
[Tt]est[Rr]esult*/ | ||
[Bb]uild[Ll]og.* | ||
|
||
#NUNIT | ||
*.VisualState.xml | ||
TestResult.xml | ||
|
||
# Build Results of an ATL Project | ||
[Dd]ebugPS/ | ||
[Rr]eleasePS/ | ||
dlldata.c | ||
|
||
*_i.c | ||
*_p.c | ||
*_i.h | ||
*.ilk | ||
*.meta | ||
*.obj | ||
*.pch | ||
*.pdb | ||
*.pgc | ||
*.pgd | ||
*.rsp | ||
*.sbr | ||
*.tlb | ||
*.tli | ||
*.tlh | ||
*.tmp | ||
*.tmp_proj | ||
*.log | ||
*.vspscc | ||
*.vssscc | ||
.builds | ||
*.pidb | ||
*.svclog | ||
*.scc | ||
|
||
# Chutzpah Test files | ||
_Chutzpah* | ||
|
||
# Visual C++ cache files | ||
ipch/ | ||
*.aps | ||
*.ncb | ||
*.opensdf | ||
*.sdf | ||
*.cachefile | ||
|
||
# Visual Studio profiler | ||
*.psess | ||
*.vsp | ||
*.vspx | ||
|
||
# TFS 2012 Local Workspace | ||
$tf/ | ||
|
||
# Guidance Automation Toolkit | ||
*.gpState | ||
|
||
# ReSharper is a .NET coding add-in | ||
_ReSharper*/ | ||
*.[Rr]e[Ss]harper | ||
*.DotSettings.user | ||
|
||
# JustCode is a .NET coding addin-in | ||
.JustCode | ||
|
||
# TeamCity is a build add-in | ||
_TeamCity* | ||
|
||
# DotCover is a Code Coverage Tool | ||
*.dotCover | ||
|
||
# NCrunch | ||
_NCrunch_* | ||
.*crunch*.local.xml | ||
|
||
# MightyMoose | ||
*.mm.* | ||
AutoTest.Net/ | ||
|
||
# Web workbench (sass) | ||
.sass-cache/ | ||
|
||
# Installshield output folder | ||
[Ee]xpress/ | ||
|
||
# DocProject is a documentation generator add-in | ||
DocProject/buildhelp/ | ||
DocProject/Help/*.HxT | ||
DocProject/Help/*.HxC | ||
DocProject/Help/*.hhc | ||
DocProject/Help/*.hhk | ||
DocProject/Help/*.hhp | ||
DocProject/Help/Html2 | ||
DocProject/Help/html | ||
|
||
# Click-Once directory | ||
publish/ | ||
|
||
# Publish Web Output | ||
*.[Pp]ublish.xml | ||
*.azurePubxml | ||
## TODO: Comment the next line if you want to checkin your | ||
## web deploy settings but do note that will include unencrypted | ||
## passwords | ||
*.pubxml | ||
|
||
# NuGet Packages | ||
packages/* | ||
*.nupkg | ||
## TODO: If the tool you use requires repositories.config | ||
## uncomment the next line | ||
#!packages/repositories.config | ||
|
||
# Enable "build/" folder in the NuGet Packages folder since | ||
# NuGet packages use it for MSBuild targets. | ||
# This line needs to be after the ignore of the build folder | ||
# (and the packages folder if the line above has been uncommented) | ||
!packages/build/ | ||
|
||
# Windows Azure Build Output | ||
csx/ | ||
*.build.csdef | ||
|
||
# Windows Store app package directory | ||
AppPackages/ | ||
|
||
# Others | ||
sql/ | ||
*.Cache | ||
ClientBin/ | ||
[Ss]tyle[Cc]op.* | ||
~$* | ||
*~ | ||
*.dbmdl | ||
*.dbproj.schemaview | ||
*.pfx | ||
*.publishsettings | ||
node_modules/ | ||
|
||
# RIA/Silverlight projects | ||
Generated_Code/ | ||
|
||
# Backup & report files from converting an old project file | ||
# to a newer Visual Studio version. Backup files are not needed, | ||
# because we have git ;-) | ||
_UpgradeReport_Files/ | ||
Backup*/ | ||
UpgradeLog*.XML | ||
UpgradeLog*.htm | ||
|
||
# SQL Server files | ||
*.mdf | ||
*.ldf | ||
|
||
# Business Intelligence projects | ||
*.rdl.data | ||
*.bim.layout | ||
*.bim_*.settings | ||
|
||
# Microsoft Fakes | ||
FakesAssemblies/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="NUnit.Runners" version="2.6.3" /> | ||
</packages> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
using NUnit.Framework; | ||
|
||
namespace Tests | ||
{ | ||
[TestFixture] | ||
public class Describe_Cons_ToString : TestHelper | ||
{ | ||
[Test] | ||
public void It_prints_an_expression_correctly() | ||
{ | ||
var c = cons(1, cons(2, cons(cons(3, cons(4, nil)), cons(5, nil)))); | ||
c.ToString().must_equal("(1 2 (3 4) 5)"); | ||
var d = cons(cons(2, 3), 1); | ||
d.ToString().must_equal("((2 . 3) . 1)"); | ||
var e = cons(1, nil); | ||
e.ToString().must_equal("(1)"); | ||
//# Is this an illogical list to be testing? | ||
var f = cons(nil, 1); | ||
f.ToString().must_equal("(nil . 1)"); | ||
} | ||
|
||
[Test] | ||
public void It_prints_a_cons_cell_representation_of_a_simple_cell() | ||
{ | ||
cons('a', 'b').ToString().must_equal("(\"a\" . \"b\")"); | ||
} | ||
|
||
[Test] | ||
public void It_represents_Integers_and_Floats() | ||
{ | ||
cons(1, 2).ToString().must_equal("(1 . 2)"); | ||
} | ||
|
||
[Test] | ||
public void It_prints_a_nested_expression() | ||
{ | ||
cons('a', cons('b', 'c')).ToString().must_equal(@"(""a"" ""b"" . ""c"")"); | ||
} | ||
|
||
[Test] | ||
public void It_represents_Arrays_correctly_in_printed_form() | ||
{ | ||
cons('a', new object[0]).ToString().must_equal(@"(""a"" . [])"); | ||
} | ||
|
||
[Test] | ||
public void It_represents_nil_elements() | ||
{ | ||
cons('a', nil).ToString().must_equal(@"(""a"")"); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System; | ||
using MicroKanren; | ||
using NUnit.Framework; | ||
|
||
namespace Tests | ||
{ | ||
[TestFixture] | ||
public class Describe_Cons_ctor:TestHelper | ||
{ | ||
[Test] | ||
public void It_takes_two_arguments_for_car_and_cdr() | ||
{ | ||
new Cons<int,int>(1, 2).must_be_instance_of(typeof (Cons)); | ||
} | ||
|
||
[Test] | ||
public void It_cant_handle_null_due_to_csharp_typesystem() | ||
{ | ||
Action ctor = () => { new Cons<int, Object>(1, null); }; ctor.must_raise<ArgumentException>(); | ||
} | ||
|
||
[Test] | ||
public void It_can_handle_null_if_using_cons_factory() | ||
{ | ||
Cons.New(1, null).Cdr.must_equal(nil); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using NUnit.Framework; | ||
|
||
namespace Tests | ||
{ | ||
[TestFixture] | ||
public class Describe_cons_equals:TestHelper | ||
{ | ||
[Test] | ||
public void It_is_true_if_the_lists_are_equal() | ||
{ | ||
cons(1, cons(2, nil)).must_equal(cons(1, cons(2, nil))); | ||
} | ||
[Test] | ||
public void It_is_false_if_the_lists_contain_different_objects() | ||
{ | ||
cons(1, cons(2, nil)).wont_equal(cons(1, nil)); | ||
} | ||
} | ||
} |
Oops, something went wrong.