<commit_before>
//
// specifying flon-dispatcher
//
// Thu Oct 30 12:39:39 JST 2014
//

#include "fl_ids.h"
#include "fl_tools.h"
#include "feu_helpers.h"


context "instruction:"
{
  before all
  {
    hlp_dispatcher_start();
  }

  before each
  {
    char *exid = NULL;
    fdja_value *result = NULL;
  }
  after each
  {
    if (exid) free(exid);
    if (result) fdja_free(result);
  }

  describe "invoke"
  {
    it "invokes an external piece of code"
    {
      exid = flon_generate_exid("n.invoke.main");

      hlp_launch(
        exid,
        "invoke stamp\n"
        "",
        "{ hello: invoke }");

      result = hlp_wait(exid, "receive", "0", 2);

      //flon_pp_execution(exid);
      //hlp_cat_inv_log(exid);

      expect(result != NULL);

      //puts(fdja_todc(result));

      expect(fdja_ls(result, "point", NULL) ===f "receive");
      expect(fdja_ls(result, "nid", NULL) ===f "0");
      expect(fdja_ls(result, "from", NULL) == NULL);

      expect(fdja_ls(result, "payload.hello", NULL) ===f "invoke");
      expect(fdja_ls(result, "payload.stamp", NULL) ^==f "20");
    }
  }
}
<commit_msg>scaffold "invoke expand its args" spec<commit_after>
//
// specifying flon-dispatcher
//
// Thu Oct 30 12:39:39 JST 2014
//

#include "fl_ids.h"
#include "fl_tools.h"
#include "feu_helpers.h"


context "instruction:"
{
  before all
  {
    hlp_dispatcher_start();
  }

  before each
  {
    char *exid = NULL;
    fdja_value *result = NULL;
  }
  after each
  {
    if (exid) free(exid);
    if (result) fdja_free(result);
  }

  describe "invoke"
  {
    it "invokes an external piece of code"
    {
      exid = flon_generate_exid("n.invoke.main");

      hlp_launch(
        exid,
        "invoke stamp\n"
        "",
        "{ hello: invoke }");

      result = hlp_wait(exid, "receive", "0", 2);

      //flon_pp_execution(exid);
      //hlp_cat_inv_log(exid);

      expect(result != NULL);
      //puts(fdja_todc(result));

      expect(fdja_ls(result, "point", NULL) ===f "receive");
      expect(fdja_ls(result, "nid", NULL) ===f "0");
      expect(fdja_ls(result, "from", NULL) == NULL);

      expect(fdja_ls(result, "payload.hello", NULL) ===f "invoke");
      expect(fdja_ls(result, "payload.stamp", NULL) ^==f "20");
    }

    it "expands its arguments"
    {
      exid = flon_generate_exid("n.invoke.expand");

      hlp_launch(
        exid,
        "invoke copyargs $(air), swiss: $(air.1), luft: $(air.2)\n"
        "",
        "{ air: [ sr, lh, em ] }");

      result = hlp_wait(exid, "terminated", NULL, 2);

      expect(result != NULL);
      puts(fdja_todc(result));

      expect(fdja_lj(result, "payload.args1") ===F fdja_vj(""
        "{ _0: copyargs, _1: [ sr, lh, em ], swiss: sr, luft: lh }"));
    }
  }
}

{'fraction_non_alphanumeric': 0.17391304347826086, 'fraction_numerical': 0.014492753623188406, 'mean_word_length': 2.544287548138639, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '5408078', 'n_tokens_mistral': 1117, 'n_tokens_neox': 1057, 'n_words': 220}