Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 0 additions & 47 deletions Src/Decorators/Undef.cs

This file was deleted.

16 changes: 16 additions & 0 deletions Src/Static/Raw.cs → Src/Static/ActiveRaw.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#if !(UNITY_EDITOR || DEBUG)
#define AL_OPTIMIZE
#endif

using Active.Core;

namespace Active{
Expand All @@ -17,6 +21,18 @@ public static class Raw{

public static status Eval(status s) => s;

#if AL_OPTIMIZE
//public static status undef => throw new Unimplemented();
//public static status undef_done => throw new Unimplemented();
//public static status undef_cont => throw new Unimplemented();
//public static status undef_fail => throw new Unimplemented();
#else
public static status undef = status._fail;
public static status undef_done = status._done;
public static status undef_cont = status._cont;
public static status undef_fail = status._fail;
#endif

public static action Do (object arg) => @void;
public static loop Cont (object arg) => forever;
public static failure Fail (object arg) => @false;
Expand Down
19 changes: 19 additions & 0 deletions Src/Static/Status.cs → Src/Static/ActiveStatus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

using Active.Core;
using V = Active.Core.Details.ValidString;
using LS = Active.Core.Details.LogString;

#if !AL_OPTIMIZE
using P = System.Runtime.CompilerServices.CallerFilePathAttribute;
Expand All @@ -31,6 +32,9 @@ public static class Status{

public static status ε(status s) => s;

//public static status undef() => throw new Unimplemented();
//public static status undef(status s) => throw new Unimplemented();

public static action Do (object arg) => action._done;
public static loop Cont (object arg) => loop._cont;
public static failure Fail (object arg) => failure._fail;
Expand Down Expand Up @@ -66,6 +70,21 @@ public static loop forever(V reason = null,
[P] S p="", [M] S m="", [L] int l=0)
=> Lg.Forever(reason, p, m, l);

// ==============================================================

public static status undef(status @value,
[P] S p="", [M] S m="", [L] int l=0)
=> status.log ? Lg.Status(@value,
(LS)null && "undef", p, m, l)
: @value;

public static status undef([P] S p="", [M] S m="", [L] int l=0)
=> status.log ? Lg.Status(status._fail,
(LS)null && "undef", p, m, l)
: status._fail;

// ==============================================================

public static status Eval(status s,
[P] S path="", [M] S member="", [L] int line=0)
=> status.log ? Lg.Status(s, null, path, member, line) : s;
Expand Down
49 changes: 0 additions & 49 deletions Tests/Decorators/TestUndef.cs

This file was deleted.

22 changes: 19 additions & 3 deletions Tests/TestActiveRaw.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
using NUnit.Framework;
using Active.Core;
using static Active.Raw;
#if !(UNITY_EDITOR || DEBUG)
#define AL_OPTIMIZE
#endif

using NUnit.Framework; using Active.Core; using static Active.Raw;
using Ex = System.Exception;

public class TestActiveRaw : TestBase{

// ...
// ...
// ...

[Test] public void Standard(){
o( done.complete );
o( fail.failing );
Expand All @@ -18,6 +25,15 @@ [Test] public void Standard(){
o( impending_fail.failing );
}

#if !AL_OPTIMIZE
[Test] public void Undef(){
o( undef.failing );
o( undef_done.complete );
o( undef_cont.running );
o( undef_fail.failing );
}
#endif

// ==============================================================

[Test] public void LongForm(){
Expand Down
18 changes: 15 additions & 3 deletions Tests/TestActiveStatus.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using NUnit.Framework;
using Active.Core;
using static Active.Status;
#if !(UNITY_EDITOR || DEBUG)
#define AL_OPTIMIZE
#endif

using NUnit.Framework; using Active.Core; using static Active.Status;
using Ex = System.Exception;

public class TestActiveStatus : TestBase{

Expand All @@ -22,6 +25,15 @@ [Test] public void Standard(){
// ...
}

#if !AL_OPTIMIZE
[Test] public void Undef(){
o( undef().failing );
o( undef(done()).complete );
o( undef(cont()).running );
o( undef(fail()).failing );
}
#endif

// ==============================================================

[Test] public void LongForm(){
Expand Down
10 changes: 3 additions & 7 deletions Tests/TestDecoratorBindings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using NUnit.Framework;
using Active.Core;
using Active.Core.Details;
using static Active.Raw;

#pragma warning disable 0618

Expand All @@ -23,18 +24,13 @@ [Test] public void TestBindings(){
o = x.Once();
o = x.Timeout(1f);
o = x.Wait(1f);
o = x.While(status.cont());
o = x.While(cont);
o = x.While(true);
o = x.with(null);
o = x.Tie(status.cont());
o = x.Tie(cont);
o = x.Tie(true);
o = x.Sequence();
o = x.Selector();

#if !AL_OPTIMIZE
o = x.undef();
#endif // !AL_OPTIMIZE

#if !AL_THREAD_SAFE
o = x.Seq();
o = x.Sel();
Expand Down