This file contains hidden or 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
// See https://aka.ms/new-console-template for more information | |
Console.WriteLine("Hello, World!"); | |
MyStack<MyItem> stack = new MyStack<MyItem>(); | |
public class MyStack<T> where T : class | |
{ | |
private T[] _items; |
This file contains hidden or 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
//Actor inherits from the ActorPolicy class. | |
class TestActor : public Actors::ActorPolicy | |
{ | |
public: | |
TestActor() : ActorPolicy{} | |
{ | |
} |
This file contains hidden or 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
TEST(SimpleActorTest, WhenUsingAsyncStatefulActorThenHasExpectedState) | |
{ | |
const int MESSAGES_COUNT = 101; | |
const int EXPECTED_STATE = MESSAGES_COUNT; | |
auto seenMessages = 0; | |
auto testState = 0; | |
{ | |
//Create the actor (asynchronous logic/with state/no reply). | |
auto stateFullActor = RStein::AsyncCpp::Actors::CreateAsyncSimpleActor<int, int>([&seenMessages, &testState](const int& message, const int& state)->Task<int> | |
{ |
This file contains hidden or 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
Tasks::Task<size_t> WhenAsyncForkJoinDataflowThenAllInputsProcessedImpl(int inputItemsCount) | |
{ | |
//Create TransformBlock. As the name of the block suggests, TransformBlock transforms input to output. | |
//Following block transforms int to string. | |
auto transform1 = DataFlowAsyncFactory::CreateTransformBlock<int, int>([](const int& item)-> Tasks::Task<int> | |
{ | |
//Simulate work | |
co_await Tasks::GetCompletedTask(); | |
auto message = "int: " + to_string(item) + "\n"; | |
cout << message; |
This file contains hidden or 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
#!/bin/bash | |
ERROR_BACKUP_DIRECTORY_CREATE=80; | |
ERROR_BACKUP_ERROR=81; | |
BACKUP_PATH="/mount/OMEGA_1/Public/RPI_BACKUP" | |
BACKUP_DIR=$(date +"%Y-%m-%d-%HH-%MM") | |
FULL_BACKUP_FILE_PATH="$BACKUP_PATH$BACKUP_DIR" | |
oldDir=$(pwd) | |
This file contains hidden or 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
[TestMethod] | |
public virtual async Task Dispose_When_Tasks_Are_Queued_Then_All_Tasks_Are_Executed() | |
{ | |
const int NUMBER_OF_TASKS = 1000; | |
const int DELAY_TASK_CAN_CONTINUE_SIGNAL_S = 1; | |
int numberOfTasksExecuted = 0; | |
var waitForSignalCts = new CancellationTokenSource(); | |
var tasks = Enumerable.Range(0, NUMBER_OF_TASKS) |
This file contains hidden or 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
[TestMethod] | |
public async Task WithTaskFactory_When_One_Task_Is_Queued_Then_Task_is_Executed() | |
{ | |
bool wasTaskExecuted = false; | |
await TestTaskFactory.StartNew(() => wasTaskExecuted = true); | |
Assert.IsTrue(wasTaskExecuted); | |
} | |
[TestMethod] |
This file contains hidden or 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
[TestMethod] | |
[ExpectedException(typeof (ArgumentOutOfRangeException))] | |
public void Ctor_When_Number_Of_Threads_Is_Zero_Then_Throws_ArgumentOutOfRangeException() | |
{ | |
var threadPool = new IoServiceThreadPoolScheduler(m_ioService, 0); | |
} | |
[TestMethod] | |
[ExpectedException(typeof (ArgumentOutOfRangeException))] | |
public void Ctor_When_Number_Of_Threads_Is_Negative_Then_Throws_ArgumentOutOfRangeException() |
This file contains hidden or 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
[TestMethod] | |
[ExpectedException(typeof (ArgumentNullException))] | |
public void Ctor_When_Io_Service_Is_Null_Then_Throws_ArgumentException() | |
{ | |
var threadPool = new IoServiceThreadPoolScheduler(null); | |
} |
This file contains hidden or 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
public abstract class IAutonomousSchedulerTests : ITaskSchedulerTests | |
{ | |
private TaskFactory m_testTaskFactory; | |
protected abstract IProxyScheduler ProxyScheduler | |
{ | |
get; | |
} | |
public TaskFactory TestTaskFactory |
NewerOlder