# Souffle - A Datalog Compiler
# Copyright (c) 2021 The Souffle Developers. All rights reserved
# Licensed under the Universal Permissive License v 1.0 as shown at:
# - https://opensource.org/licenses/UPL
# - <souffle root>/licenses/SOUFFLE-UPL.txt

include(SouffleTests)

function(POSITIVE_TEST NAME)
    souffle_positive_test(${NAME} evaluation ${ARGN})
endfunction()

positive_test(access1)
positive_test(access2)
positive_test(access3)
positive_test(adt-binary-constraint)
positive_test(adt-enum)
positive_test(aggregates)
positive_test(aggregates2)
positive_test(aggregates3)
positive_test(aggregates4)
positive_test(aggregates5)
positive_test(aggregates6)
positive_test(aggregates_complex)
positive_test(aggregates_nested)
positive_test(aggregates_non_materialised)
positive_test(aggregates7)
positive_test(aggregate_witnesses)
positive_test(aliases DEBUG_REPORT)
positive_test(arithm)
positive_test(average)
positive_test(bad_regex)
positive_test(binop)
positive_test(cat)
positive_test(choice_advisor)
positive_test(choice_total_order)
positive_test(choice_highest_mark)
positive_test(choice_colourable)
positive_test(comparator_indirect)
positive_test(comp-override1)
positive_test(comp-override2)
positive_test(comp-override3)
positive_test(components1)
positive_test(components2)
positive_test(components3)
positive_test(components)
positive_test(components_generic)
positive_test(contains)
positive_test(count)
positive_test(count_sccs1)
positive_test(counter)
positive_test(cprog1)
positive_test(cprog2)
positive_test(cprog3)
positive_test(cprog4)
positive_test(cprog5)
positive_test(cproject)
positive_test(eqrel_inc)
positive_test(eqrel_mod)
positive_test(eqrel_reachable)
positive_test(empty_relations)
positive_test(empty_relations2)
positive_test(existential)
positive_test(facts)
positive_test(facts2)
positive_test(float_equality)
positive_test(float_operations)
positive_test(functor_arity)
positive_test(grammar)
positive_test(hex)
positive_test(independent_body1)
if (NOT MSVC)
  # the semantics checker does not produce a deterministic warning
  # message location "variable occurs only once" in complex rules.
positive_test(independent_body2)
endif ()
positive_test(index)
positive_test(indexed_inequalities)
positive_test(indirect_negation)
positive_test(inline_functors)
positive_test(inline_negation1)
positive_test(inline_negation2)
positive_test(inline_nqueens)
positive_test(inline_records)
positive_test(inline_underscore)
positive_test(inline_unification)
positive_test(list)
positive_test(magic_2sat COMPILED_SPLITTED)
positive_test(magic_aggregates COMPILED_SPLITTED)
positive_test(magic_bindings)
positive_test(magic_centroids)
positive_test(magic_circuit_sat)
positive_test(magic_components)
positive_test(magic_cprog1)
positive_test(magic_dfa)
positive_test(magic_dominance)
positive_test(magic_factoring)
positive_test(magic_goal)
positive_test(magic_infbinding)
positive_test(magic_lrg_attr_id)
positive_test(magic_movies)
positive_test(magic_names1)
positive_test(magic_neglabel)
positive_test(magic_negignored)
if (NOT (MSVC AND (CMAKE_BUILD_TYPE MATCHES Debug)))
  # When compiled in Debug with Visual Studio with the default stack size of 1MB,
  # the interpreter fails with a stack overflow in Engine::execute().
  # The cause is the number of lambda functions that are allocated as locals on the stack.
  # The stack frame of Engine::execute is close to 30KB.
  # The 1MB stack will overflow at depth ~34 of Engine::execute().
positive_test(magic_nqueens)
endif ()
positive_test(magic_perfect_numbers)
positive_test(magic_posignored)
positive_test(magic_poslabel)
positive_test(magic_records4)
positive_test(magic_samegen)
positive_test(magic_strategies)
positive_test(magic_string_substr COMPILED_SPLITTED)
positive_test(magic_turing1)
positive_test(match2)
positive_test(match3)
positive_test(match4)
positive_test(match5)
positive_test(match COMPILED_SPLITTED)
# TODO (see issue #298) positive_test(math)
positive_test(max)
positive_test(minmax)
positive_test(minmaxnum)
positive_test(mrtc)
positive_test(mul)
positive_test(multiple_heads)
positive_test(multiple_inequalities)
positive_test(mutrecursion)
positive_test(neg1)
positive_test(neg2)
positive_test(neg3)
positive_test(neg4)
positive_test(neg5)
positive_test(neg6)
positive_test(number_constants)
positive_test(numeric_binary_constraint_op)
positive_test(numeric_conversions)
positive_test(ordinals)
positive_test(plus)
positive_test(range)
positive_test(rangeop)
positive_test(rec_lists2)
positive_test(rec_lists)
positive_test(rec_underscore)
positive_test(recursion)
positive_test(relop)
positive_test(rmut2)
positive_test(rmut)
positive_test(set_ops)
positive_test(set_ops_output)
positive_test(simple)
positive_test(singleton)
positive_test(subsumption)
positive_test(subtype2)
positive_test(subtype)
positive_test(sum-aggregate)
positive_test(sum-aggregate2)
positive_test(symbol_operations)
positive_test(term)
positive_test(unpacking)
positive_test(unsigned_operations)
positive_test(unused_constraints)
positive_test(x9)
positive_test(issue2160)

add_subdirectory(issue2508)
souffle_positive_functor_test(issue2508 CATEGORY evaluation)
positive_test(issue2532)
