Beispiel #1
0
def test_OpenClBacktrackingHelper_ShouldProceed_loop3(
  backtracker: backtracking_model.OpenClBacktrackingHelper,
):
  assert backtracker.ShouldProceed(
    """kernel void A(global int* a) {
  for (int i = 0; i < 10; ++i) { int x = 10;"""
  )
Beispiel #2
0
def test_OpenClBacktrackingHelper_ShouldProceed_depth1(
  backtracker: backtracking_model.OpenClBacktrackingHelper,
):
  assert backtracker.ShouldProceed(
    """kernel void A(global int* a) {
  int b = 0;"""
  )
Beispiel #3
0
def test_OpenClBacktrackingHelper_ShouldProceed_depth2(
  backtracker: backtracking_model.OpenClBacktrackingHelper,
):
  assert backtracker.ShouldProceed(
    """kernel void A(global int* a) {
  int b = 0;
  if (get_global_id(0) < 10) {
    int c = 2;"""
  )
Beispiel #4
0
def test_OpenClBacktrackingHelper_TryToCloseProgram_loop1(
  backtracker: backtracking_model.OpenClBacktrackingHelper,
):
  assert (
    backtracker.TryToCloseProgram(
      """kernel void A() {
  for (int a = 0;"""
    )
    == """kernel void A() {
  for (int a = 0;;){}}"""
  )
Beispiel #5
0
def test_OpenClBacktrackingHelper_TryToCloseProgram_depth1(
  backtracker: backtracking_model.OpenClBacktrackingHelper,
):
  assert (
    backtracker.TryToCloseProgram(
      """kernel void A() {
  int a = 0;"""
    )
    == """kernel void A() {
  int a = 0;}"""
  )
Beispiel #6
0
def test_OpenClBacktrackingHelper_TryToCloseProgram_loop3(
  backtracker: backtracking_model.OpenClBacktrackingHelper,
):
  assert (
    backtracker.TryToCloseProgram(
      """kernel void A() {
  for (int a = 0; a < 10; ++a) {
    { int x = 10;"""
    )
    == """kernel void A() {
  for (int a = 0; a < 10; ++a) {
    { int x = 10;}}}"""
  )
Beispiel #7
0
def test_OpenClBacktrackingHelper_TryToCloseProgram_depth2(
  backtracker: backtracking_model.OpenClBacktrackingHelper,
):
  assert (
    backtracker.TryToCloseProgram(
      """kernel void A() {
  int a = 0;
  if (get_global_id(0) < 10) {
    int a = 2;"""
    )
    == """kernel void A() {
  int a = 0;
  if (get_global_id(0) < 10) {
    int a = 2;}}"""
  )
Beispiel #8
0
def test_OpenClBacktrackingHelper_ShouldCheckpoint_for_loop_3(
  backtracker: backtracking_model.OpenClBacktrackingHelper,
):
  assert backtracker.ShouldCheckpoint("for (int i = 0; i < 10; ++i) { int x;")
Beispiel #9
0
def test_OpenClBacktrackingHelper_ShouldCheckpoint_yes(
  backtracker: backtracking_model.OpenClBacktrackingHelper,
):
  assert backtracker.ShouldCheckpoint("int x = 5;")
Beispiel #10
0
def test_OpenClBacktrackingHelper_TryToCloseProgram_not_end_of_statement(
  backtracker: backtracking_model.OpenClBacktrackingHelper,
):
  assert not backtracker.TryToCloseProgram("kernel void A(".split())