Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add headers #80

Closed
wants to merge 2 commits into from
Closed
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
4 changes: 4 additions & 0 deletions Aplib.Core.Tests/BdiAgentTests.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// This program has been developed by students from the bachelor Computer Science at Utrecht
// University within the Software Project course.
// Copyright Utrecht University (Department of Information and Computing Sciences)

using Aplib.Core.Agents;
using Aplib.Core.Belief.BeliefSets;
using Aplib.Core.Desire.DesireSets;
Expand Down
160 changes: 82 additions & 78 deletions Aplib.Core.Tests/Belief/BeliefSetTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
using Aplib.Core.Belief.Beliefs;
// This program has been developed by students from the bachelor Computer Science at Utrecht
// University within the Software Project course.
// Copyright Utrecht University (Department of Information and Computing Sciences)

using Aplib.Core.Belief.Beliefs;
using Aplib.Core.Belief.BeliefSets;

namespace Aplib.Core.Tests.Belief;
Expand All @@ -9,79 +13,45 @@ namespace Aplib.Core.Tests.Belief;
public class BeliefSetTests
{
/// <summary>
/// Given a BeliefSet instance with multiple <i>public field</i> beliefs,
/// When UpdateBeliefs is called,
/// Then all beliefs are updated.
/// A simple belief that can be used to test whether <see cref="UpdateBelief"/> has been called.
/// </summary>
[Fact]
public void UpdateBeliefs_PublicBeliefFields_UpdatesAllBeliefs()
private class SimpleBelief : IBelief
{
// Arrange
TestBeliefSetPublic beliefSet = new();

// Act
// UpdateBeliefs should set Updated to true for all beliefs.
beliefSet.UpdateBeliefs();
/// <summary>
/// Stores whether <see cref="UpdateBelief"/> has been called.
/// </summary>
public bool Updated { get; private set; } = false;

// Assert
Assert.True(beliefSet.Belief1.Updated);
Assert.True(beliefSet.Belief2.Updated);
/// <summary>
/// Sets <see cref="Updated"/> to true.
/// </summary>
public void UpdateBelief()
{
Updated = true;
}
}

/// <summary>
/// Given a BeliefSet instance with multiple <i>public property</i> beliefs,
/// When UpdateBeliefs is called,
/// Then no beliefs are updated.
/// </summary>
[Fact]
public void UpdateBeliefs_PublicBeliefProperties_DoesNotUpdateAnyBeliefs()
{
// Arrange
TestBeliefSetProperties beliefSet = new();

// Act
// UpdateBeliefs should *not* set Updated to true for any belief.
beliefSet.UpdateBeliefs();

// Assert
Assert.False(beliefSet.Belief1.Updated);
Assert.False(beliefSet.Belief2.Updated);
}

/// <summary>
/// Given a BeliefSet instance with multiple <i>private field</i> beliefs,
/// When UpdateBeliefs is called,
/// Then no beliefs are updated.
/// A test belief set that contains two private simple beliefs.
/// </summary>
[Fact]
public void UpdateBeliefs_PrivateBeliefFields_DoesNotUpdateAnyBeliefs()
private class TestBeliefSetPrivate : BeliefSet
{
// Arrange
TestBeliefSetPrivate beliefSet = new();

// Act
// UpdateBeliefs should *not* set Updated to true for any belief.
beliefSet.UpdateBeliefs();
/// <inheritdoc cref="_belief1"/>
public SimpleBelief Belief1 => _belief1;

// Assert
Assert.False(beliefSet.Belief1.Updated);
Assert.False(beliefSet.Belief2.Updated);
}
/// <inheritdoc cref="_belief2"/>
public SimpleBelief Belief2 => _belief2;

/// <summary>
/// A test belief set that contains two public simple beliefs.
/// </summary>
private class TestBeliefSetPublic : BeliefSet
{
/// <summary>
/// Belief that sets Updated to true when UpdateBelief is called.
/// </summary>
public SimpleBelief Belief1 = new();
private SimpleBelief _belief1 = new();

/// <summary>
/// Belief that sets Updated to true when UpdateBelief is called.
/// </summary>
public SimpleBelief Belief2 = new();
private SimpleBelief _belief2 = new();
}


Expand All @@ -101,45 +71,79 @@ private class TestBeliefSetProperties : BeliefSet
public SimpleBelief Belief2 { get; } = new();
}


/// <summary>
/// A test belief set that contains two private simple beliefs.
/// A test belief set that contains two public simple beliefs.
/// </summary>
private class TestBeliefSetPrivate : BeliefSet
private class TestBeliefSetPublic : BeliefSet
{
/// <summary>
/// Belief that sets Updated to true when UpdateBelief is called.
/// </summary>
private SimpleBelief _belief1 = new();
public SimpleBelief Belief1 = new();

/// <summary>
/// Belief that sets Updated to true when UpdateBelief is called.
/// </summary>
private SimpleBelief _belief2 = new();
public SimpleBelief Belief2 = new();
}

/// <inheritdoc cref="_belief1"/>
public SimpleBelief Belief1 => _belief1;
/// <summary>
/// Given a BeliefSet instance with multiple <i>private field</i> beliefs,
/// When UpdateBeliefs is called,
/// Then no beliefs are updated.
/// </summary>
[Fact]
public void UpdateBeliefs_PrivateBeliefFields_DoesNotUpdateAnyBeliefs()
{
// Arrange
TestBeliefSetPrivate beliefSet = new();

/// <inheritdoc cref="_belief2"/>
public SimpleBelief Belief2 => _belief2;
// Act
// UpdateBeliefs should *not* set Updated to true for any belief.
beliefSet.UpdateBeliefs();

// Assert
Assert.False(beliefSet.Belief1.Updated);
Assert.False(beliefSet.Belief2.Updated);
}

/// <summary>
/// A simple belief that can be used to test whether <see cref="UpdateBelief"/> has been called.
/// Given a BeliefSet instance with multiple <i>public field</i> beliefs,
/// When UpdateBeliefs is called,
/// Then all beliefs are updated.
/// </summary>
private class SimpleBelief : IBelief
[Fact]
public void UpdateBeliefs_PublicBeliefFields_UpdatesAllBeliefs()
{
/// <summary>
/// Stores whether <see cref="UpdateBelief"/> has been called.
/// </summary>
public bool Updated { get; private set; } = false;
// Arrange
TestBeliefSetPublic beliefSet = new();

/// <summary>
/// Sets <see cref="Updated"/> to true.
/// </summary>
public void UpdateBelief()
{
Updated = true;
}
// Act
// UpdateBeliefs should set Updated to true for all beliefs.
beliefSet.UpdateBeliefs();

// Assert
Assert.True(beliefSet.Belief1.Updated);
Assert.True(beliefSet.Belief2.Updated);
}

/// <summary>
/// Given a BeliefSet instance with multiple <i>public property</i> beliefs,
/// When UpdateBeliefs is called,
/// Then no beliefs are updated.
/// </summary>
[Fact]
public void UpdateBeliefs_PublicBeliefProperties_DoesNotUpdateAnyBeliefs()
{
// Arrange
TestBeliefSetProperties beliefSet = new();

// Act
// UpdateBeliefs should *not* set Updated to true for any belief.
beliefSet.UpdateBeliefs();

// Assert
Assert.False(beliefSet.Belief1.Updated);
Assert.False(beliefSet.Belief2.Updated);
}
}
Loading