File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed
private/topology/underlay
verification/dependencies/strings Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,10 @@ const (
4747 EndhostPort = 30041
4848)
4949
50- func (o Type ) String () string {
50+ // @ requires low(o)
51+ // @ requires o == UDPIPv4 || o == UDPIPv6 || o == UDPIPv46
52+ // @ ensures low(res)
53+ func (o Type ) String () (res string ) {
5154 switch o {
5255 case UDPIPv4 :
5356 return UDPIPv4Name
@@ -56,11 +59,14 @@ func (o Type) String() string {
5659 case UDPIPv46 :
5760 return UDPIPv46Name
5861 default :
62+ // @ Unreachable()
5963 return fmt .Sprintf ("UNKNOWN (%d)" , o )
6064 }
6165}
6266
63- func TypeFromString (s string ) (Type , error ) {
67+ // @ requires low(s)
68+ // @ ensures low(t) && low(err != nil)
69+ func TypeFromString (s string ) (t Type , err error ) {
6470 switch strings .ToLower (s ) {
6571 case strings .ToLower (UDPIPv4Name ):
6672 return UDPIPv4 , nil
@@ -94,7 +100,9 @@ func (ot Type) MarshalJSON() ([]byte, error) {
94100 return json .Marshal (ot .String ())
95101}
96102
97- func (ot Type ) IsUDP () bool {
103+ // @ requires low(ot)
104+ // @ ensures low(res)
105+ func (ot Type ) IsUDP () (res bool ) {
98106 switch ot {
99107 case UDPIPv4 , UDPIPv6 , UDPIPv46 :
100108 return true
Original file line number Diff line number Diff line change @@ -111,8 +111,9 @@ decreases _
111111func ToUpper(s string) string
112112
113113// ToLower returns s with all Unicode letters mapped to their lower case.
114+ ensures low(s) ==> low(res)
114115decreases _
115- func ToLower(s string) string
116+ func ToLower(s string) (res string)
116117
117118// ToTitle returns a copy of the string s with all Unicode letters mapped to
118119// their Unicode title case.
You can’t perform that action at this time.
0 commit comments