text
stringlengths
0
234
neigh_cand.down := id;
elsif es(1) = neigh_es(3) then
c.right := neigh_cand.id;
neigh_cand.left := id;
elsif es(2) = neigh_es(0) then
c.down := neigh_cand.id;
neigh_cand.up := id;
elsif es(3) = neigh_es(1) then
c.left := neigh_cand.id;
neigh_cand.right := id;
else
return false;
end if;
state(c.id) := c;
state(neigh_cand.id) := neigh_cand;
Function Definition: procedure flatten_allergens is
Function Body: s : String_Sets.Set;
begin
for c in allergen_ingredients.Iterate loop
s.clear;
for v of allergen_ingredients(c) loop
s := s or v;
end loop;
allergens.insert(key(c), s);
end loop;
end flatten_allergens;
function all_length_one return Boolean is
begin
for c in allergens.iterate loop
if allergens(c).length /= 1 then
return false;
end if;
end loop;
return true;
end all_length_one;
function all_singles return String_Sets.Set is
s : String_Sets.Set := String_Sets.Empty_Set;
begin
for c in allergens.iterate loop
if allergens(c).length = 1 then
s.include(allergens(c).first_element);
end if;
end loop;
return s;
end all_singles;
procedure reduce_allergens is
begin
loop
if all_length_one then
exit;
end if;
declare
singles : constant String_Sets.Set := all_singles;
begin
if singles.is_empty then
TIO.put_line("No single element sets!");
exit;
end if;
for k of allergen_keys loop
if allergens(to_string(k)).length > 1 then
allergens(to_string(k)) := allergens(to_string(k)) - singles;
end if;
end loop;
Function Definition: procedure Test_Create_Decoder is
Function Body: Decoder_Mono_8_kHz : Decoder_Data;
begin
Decoder_Mono_8_kHz := Create (Rate_8_kHz, Mono);
Assert (Get_Sample_Rate (Decoder_Mono_8_kHz) = Rate_8_kHz, Unexpected_Sampling_Rate_Message);
end Test_Create_Decoder;
procedure Test_Destroy_Decoder is
Decoder : constant Decoder_Data := Create (Rate_8_kHz, Mono);
begin
Destroy (Decoder);
end Test_Destroy_Decoder;
procedure Test_Reset_State is
Decoder : constant Decoder_Data := Create (Rate_8_kHz, Stereo);
begin
Reset_State (Decoder);
end Test_Reset_State;
procedure Test_Default_Configuration is
Decoder : constant Decoder_Data := Create (Rate_8_kHz, Mono);
begin
Assert (Get_Sample_Rate (Decoder) = Rate_8_kHz, Unexpected_Configuration_Message);
Assert (Get_Channels (Decoder) = Mono, Unexpected_Configuration_Message);
Assert (Get_Pitch (Decoder) = 0, Unexpected_Configuration_Message);
Assert (Get_Gain (Decoder) = 0, Unexpected_Configuration_Message);
Assert (Get_Last_Packet_Duration (Decoder) = 0, Unexpected_Configuration_Message);
declare
Unused_Result : Bandwidth;
begin