<commit_before>%% -------------------------------------------------------------------
%%
%% Copyright (c) 2014 SyncFree Consortium.  All Rights Reserved.
%%
%% This file is provided to you under the Apache License,
%% Version 2.0 (the "License"); you may not use this file
%% except in compliance with the License.  You may obtain
%% a copy of the License at
%%
%%   http://www.apache.org/licenses/LICENSE-2.0
%%
%% Unless required by applicable law or agreed to in writing,
%% software distributed under the License is distributed on an
%% "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
%% KIND, either express or implied.  See the License for the
%% specific language governing permissions and limitations
%% under the License.
%%
%% -------------------------------------------------------------------

%% @doc Advertisement counter.

-module(lasp_advertisement_counter_test).
-author("<NAME> <<EMAIL>>").

-export([test/0,
         client/3,
         server/2]).

-ifdef(TEST).

-export([confirm/0]).

-define(HARNESS, (rt_config:get(rt_harness))).

-include_lib("eunit/include/eunit.hrl").

confirm() ->
    [Nodes] = rt:build_clusters([1]),
    lager:info("Nodes: ~p", [Nodes]),
    Node = hd(Nodes),

    lager:info("Remotely loading code on node ~p", [Node]),
    ok = lasp_test_helpers:load(Nodes),
    lager:info("Remote code loading complete."),

    %% @TODO: uncomment this before going multinode
    %% ok = lasp_test_helpers:wait_for_cluster(Nodes),

    lager:info("Remotely executing the test."),
    Result = rpc:call(Node, ?MODULE, test, []),
    ?assertEqual(ok, Result),

    pass.

-endif.

-define(SET, riak_dt_orset).

-define(COUNTER, riak_dt_gcounter).

-record(ad, {id, image, counter}).

-record(contract, {id}).

test() ->

    %% Setup lists of advertisements and lists of contracts for
    %% advertisements.

    %% Generate a series of unique identifiers.
    Ids = lists:map(fun(_) -> druuid:v4() end, lists:seq(1, 5)),
    lager:info("Identifiers are: ~p", [Ids]),

    %% For each identifier, generate an advertisement.
    {ok, Ads} = lasp:declare(?SET),
    lists:map(fun(Id) ->
                %% Generate a G-Counter.
                {ok, CounterId} = lasp:declare(?COUNTER),<commit_msg>Uncomment code.<commit_after>%% -------------------------------------------------------------------
%%
%% Copyright (c) 2014 SyncFree Consortium.  All Rights Reserved.
%%
%% This file is provided to you under the Apache License,
%% Version 2.0 (the "License"); you may not use this file
%% except in compliance with the License.  You may obtain
%% a copy of the License at
%%
%%   http://www.apache.org/licenses/LICENSE-2.0
%%
%% Unless required by applicable law or agreed to in writing,
%% software distributed under the License is distributed on an
%% "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
%% KIND, either express or implied.  See the License for the
%% specific language governing permissions and limitations
%% under the License.
%%
%% -------------------------------------------------------------------

%% @doc Advertisement counter.

-module(lasp_advertisement_counter_test).
-author("<NAME> <<EMAIL>>").

-export([test/0,
         client/3,
         server/2]).

-ifdef(TEST).

-export([confirm/0]).

-define(HARNESS, (rt_config:get(rt_harness))).

-include_lib("eunit/include/eunit.hrl").

confirm() ->
    [Nodes] = rt:build_clusters([1]),
    lager:info("Nodes: ~p", [Nodes]),
    Node = hd(Nodes),

    lager:info("Remotely loading code on node ~p", [Node]),
    ok = lasp_test_helpers:load(Nodes),
    lager:info("Remote code loading complete."),

    ok = lasp_test_helpers:wait_for_cluster(Nodes),

    lager:info("Remotely executing the test."),
    Result = rpc:call(Node, ?MODULE, test, []),
    ?assertEqual(ok, Result),

    pass.

-endif.

-define(SET, riak_dt_orset).

-define(COUNTER, riak_dt_gcounter).

-record(ad, {id, image, counter}).

-record(contract, {id}).

test() ->

    %% Setup lists of advertisements and lists of contracts for
    %% advertisements.

    %% Generate a series of unique identifiers.
    Ids = lists:map(fun(_) -> druuid:v4() end, lists:seq(1, 5)),
    lager:info("Identifiers are: ~p", [Ids]),

    %% For each identifier, generate an advertisement.
    {ok, Ads} = lasp:declare(?SET),
    lists:map(fun(Id) ->
                %% Generate a G-Counter.
                {ok, CounterId} = lasp:declare(?COUNTER),
{'fraction_non_alphanumeric': 0.20226500566251415, 'fraction_numerical': 0.0072480181200453, 'mean_word_length': 2.7840616966580978, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '519531', 'n_tokens_mistral': 1390, 'n_tokens_neox': 1315, 'n_words': 394}