From 289a705fa36e13ca9d3b4b7fa5f7bb632469f9bb Mon Sep 17 00:00:00 2001 From: Eishun Kondoh Date: Tue, 4 Jun 2019 19:00:20 +0900 Subject: [PATCH] test: Add testcases for set_config codec --- test/lib/openflow/ofp_set_config_test.exs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/lib/openflow/ofp_set_config_test.exs b/test/lib/openflow/ofp_set_config_test.exs index fd7b7e6..8eaaf68 100644 --- a/test/lib/openflow/ofp_set_config_test.exs +++ b/test/lib/openflow/ofp_set_config_test.exs @@ -14,6 +14,20 @@ defmodule OfpSetConfigTest do assert config.flags == [] assert config.miss_send_len == 128 end + + test "with a flag option" do + binary = <<0x04, 0x09, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x02, 0xff, 0xe5>> + + set_config = + binary + |> Openflow.read() + |> Kernel.elem(1) + + assert set_config.version == 4 + assert set_config.xid == 13 + assert set_config.flags == [:fragment_reassemble] + assert set_config.miss_send_len == :max + end end describe "Openflow.to_binary/1" do @@ -31,5 +45,11 @@ defmodule OfpSetConfigTest do assert Openflow.to_binary(config) == expect end + + test "with a flag option" do + binary = <<0x04, 0x09, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x02, 0xff, 0xe5>> + set_config = Openflow.SetConfig.new(xid: 13, flags: [:fragment_reassemble], miss_send_len: :max) + ^binary = Openflow.to_binary(set_config) + end end end