/* Validate the behavior of cooperative thread when it yields. 
Create 3 threads of priority -2, -1 and 0. Yield the main thread which is cooperative. Check if all the threads gets executed.  */
ZTEST(threads_scheduling, test_yield_cooperative)
/* Validate the behavior of cooperative thread when it yields. 
Create 3 threads of priority -2, -1 and 0. Yield the main thread which is cooperative. Check if all the threads gets executed.  */
ZTEST(threads_scheduling, test_yield_cooperative)
{
	init_prio = -1;
	setup_threads();
	spawn_threads(0);
	k_yield();
	zassert_true(tdata[0].executed == 1);
	zassert_true(tdata[1].executed == 1);
	for (int i = 2; i < THREADS_NUM; i++) {
		zassert_true(tdata[i].executed == 0);
	}
	teardown_threads();
}