From 5a9cdd3cc89507d4d74f8bded56ce5e037b3b56e Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Fri, 23 Feb 2024 07:08:18 +0100 Subject: wip --- learn-you-some-erlang/ct/demo/basic_SUITE.erl | 13 +++++++++++++ learn-you-some-erlang/ct/demo/state_SUITE.erl | 24 ++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 learn-you-some-erlang/ct/demo/basic_SUITE.erl create mode 100644 learn-you-some-erlang/ct/demo/state_SUITE.erl (limited to 'learn-you-some-erlang/ct/demo') diff --git a/learn-you-some-erlang/ct/demo/basic_SUITE.erl b/learn-you-some-erlang/ct/demo/basic_SUITE.erl new file mode 100644 index 0000000..566ff54 --- /dev/null +++ b/learn-you-some-erlang/ct/demo/basic_SUITE.erl @@ -0,0 +1,13 @@ +-module(basic_SUITE). +-include_lib("common_test/include/ct.hrl"). +-export([all/0]). +-export([test1/1, test2/1]). + +all() -> [test1,test2]. + +test1(_Config) -> + 1 = 1. + +test2(_Config) -> + A = 0, + 1/A. diff --git a/learn-you-some-erlang/ct/demo/state_SUITE.erl b/learn-you-some-erlang/ct/demo/state_SUITE.erl new file mode 100644 index 0000000..3ee0e5b --- /dev/null +++ b/learn-you-some-erlang/ct/demo/state_SUITE.erl @@ -0,0 +1,24 @@ +-module(state_SUITE). +-include_lib("common_test/include/ct.hrl"). + +-export([all/0, init_per_testcase/2, end_per_testcase/2]). +-export([ets_tests/1]). + +all() -> [ets_tests]. + +init_per_testcase(ets_tests, Config) -> + TabId = ets:new(account, [ordered_set, public]), + ets:insert(TabId, {andy, 2131}), + ets:insert(TabId, {david, 12}), + ets:insert(TabId, {steve, 12943752}), + [{table,TabId} | Config]. + +end_per_testcase(ets_tests, Config) -> + ets:delete(?config(table, Config)). + +ets_tests(Config) -> + TabId = ?config(table, Config), + [{david, 12}] = ets:lookup(TabId, david), + steve = ets:last(TabId), + true = ets:insert(TabId, {zachary, 99}), + zachary = ets:last(TabId). -- cgit v1.2.3