quality: Add test cases for flow_mod message

This commit is contained in:
Eishun Kondoh 2019-04-28 13:13:30 +09:00
parent c2f731d38a
commit 42dd435b63
2 changed files with 88 additions and 30 deletions

View file

@ -14,7 +14,16 @@ defmodule OfpFlowModTest do
describe "Openflow.read/1" do
test "with OFP_FLOW_MOD packet(1)" do
binary = File.read!(@flow_mod1)
{:ok, fm, ""} = Openflow.read(binary)
fm =
binary
|> Openflow.read()
|> elem(1)
|> Map.to_list()
|> Openflow.FlowMod.new()
|> Openflow.to_binary()
|> Openflow.read()
|> elem(1)
assert fm.cookie == 0
assert fm.cookie_mask == 0