<commit_before>#
# @TEST-EXEC: bro ./dtest.evt %INPUT
#
# @TEST-KNOWN-FAILURE: enum convert problem. Comment line 16 to toggle error.

# @TEST-START-FILE dtest.evt

grammar dtest.pac2;

protocol analyzer pac2::dtest over UDP:
    parse with dtest::Message,
    port 47808/udp;

on dtest::Message -> event dtest_message(self.func);

on dtest::Message -> event dtest_result (self.sub.result);

# @TEST-END-FILE
# @TEST-START-FILE dtest.pac2

module dtest;

type FUNCS = enum {
 A, B, C, D, E, F
};

type RESULT = enum {
 A, B, C, D, E, F
};

export type Message = unit {
  func: uint8 &convert=FUNCS($$);
  sub: SubMessage;
};

type SubMessage = unit {
  result: uint8 &convert=RESULT($$);
};

# @TEST-END-FILE<commit_msg>name enum convert test fail again.<commit_after>#
# @TEST-EXEC: bro ./dtest.evt %INPUT
#
# @TEST-KNOWN-FAILURE: enum convert problem. Comment line 16 to toggle error.
#
# @TEST-START-FILE dtest.evt

grammar dtest.pac2;

protocol analyzer pac2::dtest over UDP:
    parse with dtest::Message,
    port 47808/udp;

on dtest::Message -> event dtest_message(self.func);

on dtest::Message -> event dtest_result(self.sub.result);

on dtest::Message -> event dtest_result_tuple(dtest::bro_result(self));

# @TEST-END-FILE
# @TEST-START-FILE dtest.pac2

module dtest;

export type FUNCS = enum {
 A=0, B=1, C=2, D=3, E=4, F=5
};

export type RESULT = enum {
 A, B, C, D, E, F
};

export type Message = unit {
  func: uint8 &convert=FUNCS($$);
  sub: SubMessage;
};

type SubMessage = unit {
  result: uint8 &convert=RESULT($$);
};

tuple<FUNCS, RESULT> bro_result(entry: Message) {
	return (entry.func, entry.sub.result);
}

# @TEST-END-FILE
{'fraction_non_alphanumeric': 0.15366001209921354, 'fraction_numerical': 0.018148820326678767, 'mean_word_length': 4.027355623100304, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 9, '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': '4016533', 'n_tokens_mistral': 647, 'n_tokens_neox': 630, 'n_words': 170}