This repository has been archived by the owner on Dec 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
mu_test.go
736 lines (639 loc) · 22.9 KB
/
mu_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
package schemax
import (
"fmt"
"testing"
)
/*
This example demonstrates the means for marshaling an instance of
[MatchingRuleUse] from a map[string]any instance.
*/
func ExampleMatchingRuleUse_Marshal() {
m := map[string]any{
`NAME`: `caseIgnoreMatch`,
`DESC`: `This is an example`,
`NUMERICOID`: `2.5.13.2`,
`APPLIES`: []string{`cn`, `sn`},
}
var def MatchingRuleUse = mySchema.NewMatchingRuleUse()
if err := def.Marshal(m); err != nil {
fmt.Println(err)
return
}
fmt.Printf("%s\n", def)
// Output: ( 2.5.13.2
// NAME 'caseIgnoreMatch'
// DESC 'This is an example'
// APPLIES ( cn
// $ sn ) )
}
/*
This example demonstrates manual assembly of a new [MatchingRuleUse]
instance. Note this is provided for demonstration purposes only and
in context does not perform anything useful.
In general it is not necessary for end-users to manually define
this kind of instance. Instances of this type are normally created
by automated processes when new [AttributeType] definitions are created
or introduced which make use of a given [MatchingRule] instance.
*/
func ExampleNewMatchingRuleUse() {
var def MatchingRuleUse = NewMatchingRuleUse().SetSchema(mySchema)
def.SetNumericOID(`2.5.13.16`).
SetName(`fakeBitStringMatch`).
SetExtension(`X-ORIGIN`, `NOWHERE`)
for _, apl := range []AttributeType{
mySchema.AttributeTypes().Get(`cn`),
mySchema.AttributeTypes().Get(`sn`),
mySchema.AttributeTypes().Get(`l`),
} {
def.SetApplies(apl)
}
// We're done and ready, set the stringer
def.SetStringer()
fmt.Printf("%s", def)
// Output: ( 2.5.13.16
// NAME 'fakeBitStringMatch'
// APPLIES ( cn
// $ sn
// $ l )
// X-ORIGIN 'NOWHERE' )
}
/*
This example demonstrates the futility of attempting to parse a raw
string-based matchingRuleUse definition into a proper instance of
[MatchingRuleUse], as these definitions are auto-generated by the
DSA governed by the relevant schema; not parsed from input.
*/
func ExampleMatchingRuleUse_Parse() {
var raw string = `( 2.5.13.21
NAME 'tellyMatch'
APPLIES sponsorTelephoneNumber
X-ORIGIN 'NOWHERE' )`
var def MatchingRuleUse
fmt.Println(def.Parse(raw))
// Output: Parsing is not applicable to a MatchingRuleUse
}
/*
This example demonstrates a means of initializing a new instance of
[MatchingRuleUse], with the receiver instance of [Schema] automatically
registered as its origin.
Generally this is not needed, and is shown here merely for coverage
purposes. [MatchingRuleUse] instances are expected to be generated
automatically by the DSA(s) governed by the relevant [Schema], and
never parsed through user input.
Note: this example assumes a legitimate schema variable is defined
in place of the fictional "mySchema" var shown here for simplicity.
*/
func ExampleSchema_NewMatchingRuleUse() {
var def MatchingRuleUse = mySchema.NewMatchingRuleUse()
fmt.Println(def.Type())
// Output: matchingRuleUse
}
/*
This example demonstrates accessing the principal name of the receiver
instance.
Note: this example assumes a legitimate schema variable is defined
in place of the fictional "mySchema" var shown here for simplicity.
*/
func ExampleMatchingRuleUse_Name() {
im := mySchema.MatchingRuleUses().Get(`2.5.13.14`)
fmt.Println(im.Name())
// Output: integerMatch
}
/*
This example demonstrates accessing the numeric OID of the receiver
instance.
Note: this example assumes a legitimate schema variable is defined
in place of the fictional "mySchema" var shown here for simplicity.
*/
func ExampleMatchingRuleUse_NumericOID() {
im := mySchema.MatchingRuleUses().Get(`integerMatch`)
fmt.Println(im.NumericOID())
// Output: 2.5.13.14
}
/*
This example demonstrates accessing the OID -- whether it is the principal
name or numeric OID -- of the receiver instance.
Note: this example assumes a legitimate schema variable is defined
in place of the fictional "mySchema" var shown here for simplicity.
*/
func ExampleMatchingRuleUse_OID() {
im := mySchema.MatchingRuleUses().Get(`2.5.13.14`)
fmt.Println(im.OID())
// Output: integerMatch
}
//func ExampleMatchingRuleUse_Map() {
// def := mySchema.MatchingRuleUses().Get(`2.5.13.14`)
// fmt.Println(def.Map()[`SYNTAX`][0]) // risky, just for simplicity
// Output: 1.3.6.1.4.1.1466.115.121.1.15
//}
/*
This example demonstrates use of the [MatchingRuleUses.Maps] method, which
produces slices of [DefinitionMap] instances born of the [MatchingRuleUses]
stack in which they reside. We (quite recklessly) call index three (3)
and reference index zero (0) of its `SYNTAX` key to obtain the relevant
[LDAPSyntax] OID string value.
*/
//func ExampleMatchingRuleUses_Maps() {
// defs := mySchema.MatchingRuleUses().Maps()
// fmt.Println(defs[3][`SYNTAX`][0]) // risky, just for simplicity
// Output: 1.3.6.1.4.1.1466.115.121.1.15
//}
/*
This example demonstrates the means for accessing all [MatchingRuleUse]
instances which bear the specified `X-ORIGIN` extension value.
Note: this example assumes a legitimate schema variable is defined
in place of the fictional "mySchema" var shown here for simplicity.
*/
func ExampleMatchingRuleUses_XOrigin() {
defs := mySchema.MatchingRuleUses()
matches := defs.XOrigin(`Bogus RFC`)
fmt.Printf("Matched %d of %d %s\n", matches.Len(), defs.Len(), defs.Type())
// Output: Matched 0 of 32 matchingRuleUses
}
/*
This example demonstrates use of the [MatchingRuleUses.Type] method to determine
the type of stack defined within the receiver. This is mainly useful in cases
where multiple stacks are being iterated in [Definitions] interface contexts
and is more efficient when compared to manual type assertion.
Note: this example assumes a legitimate schema variable is defined
in place of the fictional "mySchema" var shown here for simplicity.
*/
func ExampleMatchingRuleUses_Type() {
mrs := mySchema.MatchingRuleUses()
fmt.Printf("We have %d %s", mrs.Len(), mrs.Type())
// Output: We have 32 matchingRuleUses
}
/*
This example demonstrates the means of accessing the integer length of
a [MatchingRuleUses] stack instance.
Note: this example assumes a legitimate schema variable is defined
in place of the fictional "mySchema" var shown here for simplicity.
*/
func ExampleMatchingRuleUses_Len() {
mrs := mySchema.MatchingRuleUses()
fmt.Printf("We have %d %s", mrs.Len(), mrs.Type())
// Output: We have 32 matchingRuleUses
}
/*
This example demonstrates the means of accessing a specific slice value
within an instance of [MatchingRuleUses] by way of its associated integer
index.
Note: this example assumes a legitimate schema variable is defined
in place of the fictional "mySchema" var shown here for simplicity.
*/
func ExampleMatchingRuleUses_Index() {
slice := mySchema.MatchingRuleUses().Index(3)
fmt.Println(slice)
// Output: ( 2.5.13.28
// NAME 'generalizedTimeOrderingMatch'
// APPLIES ( createTimestamp
// $ modifyTimestamp
// $ subschemaTimestamp
// $ registrationCreated
// $ registrationModified
// $ currentAuthorityStartTimestamp
// $ firstAuthorityStartTimestamp
// $ firstAuthorityEndTimestamp
// $ sponsorStartTimestamp
// $ sponsorEndTimestamp )
// X-ORIGIN 'RFC4517' )
}
func ExampleMatchingRuleUse_Data() {
mr := mySchema.MatchingRuleUses().Get(`caseIgnoreMatch`)
// Let's pretend img ([]uint8) represents
// some JPEG data (e.g.: a diagram)
var img []uint8 = []uint8{0x1, 0x2, 0x3, 0x4}
mr.SetData(img)
got := mr.Data().([]uint8)
fmt.Printf("%T, Len:%d", got, len(got))
// Output: []uint8, Len:4
}
func ExampleMatchingRuleUse_SetData() {
mr := mySchema.MatchingRuleUses().Get(`caseIgnoreMatch`)
// Let's pretend img ([]uint8) represents
// some JPEG data (e.g.: a diagram)
var img []uint8 = []uint8{0x1, 0x2, 0x3, 0x4}
mr.SetData(img)
got := mr.Data().([]uint8)
fmt.Printf("%T, Len:%d", got, len(got))
// Output: []uint8, Len:4
}
func ExampleMatchingRuleUse_Obsolete() {
def := mySchema.MatchingRuleUses().Get(`caseExactMatch`)
fmt.Println(def.Obsolete())
// Output: false
}
/*
This example demonstrates instant compliance checks for all [MatchingRuleUse]
instances present within an instance of [MatchingRuleUses].
Note: this example assumes a legitimate schema variable is defined
in place of the fictional "mySchema" var shown here for simplicity.
*/
func ExampleMatchingRuleUses_Compliant() {
mus := mySchema.MatchingRuleUses()
fmt.Printf("All %d %s are compliant: %t", mus.Len(), mus.Type(), mus.Compliant())
// Output: All 32 matchingRuleUses are compliant: true
}
/*
This example demonstrates use of the [MatchingRuleUse.SetStringer] method
to impose a custom [Stringer] closure over the default instance.
Naturally the end-user would opt for a more useful stringer, such as one
that produces singular CSV rows per instance.
To avoid impacting other unit tests, we reset the default stringer
via the [MatchingRuleUse.SetStringer] method again, with no arguments.
Note: this example assumes a legitimate schema variable is defined
in place of the fictional "mySchema" var shown here for simplicity.
*/
func ExampleMatchingRuleUse_SetStringer() {
cim := mySchema.MatchingRuleUses().Get(`caseIgnoreMatch`)
cim.SetStringer(func() string {
return "This useless message brought to you by a dumb stringer"
})
msg := fmt.Sprintln(cim)
cim.SetStringer() // return it to its previous state if need be ...
fmt.Printf("Original: %s\nOld: %s", cim, msg)
// Output: Original: ( 2.5.13.2
// NAME 'caseIgnoreMatch'
// APPLIES ( carLicense
// $ departmentNumber
// $ displayName
// $ employeeNumber
// $ employeeType
// $ preferredLanguage
// $ name
// $ businessCategory
// $ description
// $ destinationIndicator
// $ dnQualifier
// $ houseIdentifier
// $ physicalDeliveryOfficeName
// $ postalCode
// $ postOfficeBox
// $ serialNumber
// $ street
// $ uid
// $ buildingName
// $ co
// $ documentIdentifier
// $ documentLocation
// $ documentPublisher
// $ documentTitle
// $ documentVersion
// $ drink
// $ host
// $ info
// $ organizationalStatus
// $ personalTitle
// $ roomNumber
// $ uniqueIdentifier
// $ userClass
// $ uddiBusinessKey
// $ uddiOperator
// $ uddiName
// $ uddiDescription
// $ uddiDiscoveryURLs
// $ uddiUseType
// $ uddiPersonName
// $ uddiPhone
// $ uddiEMail
// $ uddiSortCode
// $ uddiTModelKey
// $ uddiAddressLine
// $ uddiIdentifierBag
// $ uddiCategoryBag
// $ uddiKeyedReference
// $ uddiServiceKey
// $ uddiBindingKey
// $ uddiAccessPoint
// $ uddiHostingRedirector
// $ uddiInstanceDescription
// $ uddiInstanceParms
// $ uddiOverviewDescription
// $ uddiOverviewURL
// $ uddiFromKey
// $ uddiToKey
// $ uddiUUID
// $ uddiLang
// $ uddiv3BusinessKey
// $ uddiv3ServiceKey
// $ uddiv3BindingKey
// $ uddiv3TModelKey
// $ uddiv3NodeId
// $ uddiv3SubscriptionKey
// $ uddiv3SubscriptionFilter
// $ uddiv3NotificationInterval
// $ uddiv3EntityKey
// $ aSN1Notation )
// X-ORIGIN 'RFC4517' )
// Old: This useless message brought to you by a dumb stringer
}
/*
This example demonstrates use of the [MatchingRuleUses.SetStringer] method
to impose a custom [Stringer] closure upon all stack members.
Naturally the end-user would opt for a more useful stringer, such as one
that produces a CSV file containing all [MatchingRuleUse] instances.
To avoid impacting other unit tests, we reset the default stringer
via the [MatchingRuleUses.SetStringer] method again, with no arguments.
Note: this example assumes a legitimate schema variable is defined
in place of the fictional "mySchema" var shown here for simplicity.
*/
func ExampleMatchingRuleUses_SetStringer() {
mrs := mySchema.MatchingRuleUses()
mrs.SetStringer(func() string {
return "" // make a null stringer
})
output := mrs.String()
mrs.SetStringer() // return to default
fmt.Println(output)
// Output:
}
/*
This example demonstrates use of the [MatchingRuleUses.Maps] method, which
produces slices of [DefinitionMap] instances containing [MatchingRuleUse]
derived values
Here, we (quite recklessly) call index three (3) and reference index zero
(0) of its `SYNTAX` key to obtain the relevant [LDAPSyntax] OID string value.
Note: this example assumes a legitimate schema variable is defined
in place of the fictional "mySchema" var shown here for simplicity.
*/
func ExampleMatchingRuleUses_Maps() {
defs := mySchema.MatchingRuleUses().Maps()
fmt.Println(defs[3][`APPLIES`][0]) // risky, just for simplicity
// Output: createTimestamp
}
/*
This example demonstrates the means of transferring a [MatchingRuleUse]
into an instance of [DefinitionMap].
Note: this example assumes a legitimate schema variable is defined
in place of the fictional "mySchema" var shown here for simplicity.
*/
func ExampleMatchingRuleUse_Map() {
def := mySchema.MatchingRuleUses().Get(`caseIgnoreMatch`)
fmt.Println(def.Map()[`NUMERICOID`][0]) // risky, just for simplicity
// Output: 2.5.13.2
}
/*
This example demonstrates the creation of an [Inventory] instance based
upon the current contents of a [MatchingRuleUses] stack instance. Use
of an [Inventory] instance is convenient in cases where a receiver of
schema information may not be able to directly receive working stack
instances and requires a more portable and generalized type.
Note: this example assumes a legitimate schema variable is defined
in place of the fictional "mySchema" var shown here for simplicity.
*/
func ExampleMatchingRuleUses_Inventory() {
at := mySchema.MatchingRuleUses().Inventory()
fmt.Println(at[`2.5.13.2`][0])
// Output: caseIgnoreMatch
}
func ExampleMatchingRuleUses_IsZero() {
var mus MatchingRuleUses
fmt.Println(mus.IsZero())
// Output: true
}
/*
This example demonstrates a means of accessing the underlying [Extensions]
stack instance within the receiver instance.
Note: this example assumes a legitimate schema variable is defined
in place of the fictional "mySchema" var shown here for simplicity.
*/
func ExampleMatchingRuleUse_Extensions() {
cim := mySchema.MatchingRuleUses().Get(`caseIgnoreMatch`)
fmt.Println(cim.Extensions())
// Output: X-ORIGIN 'RFC4517'
}
/*
This example demonstrates accessing the description clause within the
receiver instance. Most [MatchingRuleUse] instances do not have any
descriptive text set, thus like others this example produces no value.
Note: this example assumes a legitimate schema variable is defined
in place of the fictional "mySchema" var shown here for simplicity.
*/
func ExampleMatchingRuleUse_Description() {
cim := mySchema.MatchingRuleUses().Get(`caseIgnoreMatch`)
fmt.Println(cim.Description())
// Output:
}
func ExampleMatchingRuleUse_SetDescription() {
cim := mySchema.MatchingRuleUses().Get(`caseIgnoreMatch`)
cim.SetDescription("Caseless string match")
fmt.Println(cim.Description())
// Output: Caseless string match
}
func ExampleMatchingRuleUse_Names() {
cim := mySchema.MatchingRuleUses().Get(`2.5.13.2`)
fmt.Println(cim.Names())
// Output: 'caseIgnoreMatch'
}
/*
This example demonstrates calling the 3rd index of the [MatchingRuleUses]
stack of our [Schema] and performing a compliancy checking on the slice.
Note: this example assumes a legitimate schema variable is defined
in place of the fictional "mySchema" var shown here for simplicity.
*/
func ExampleMatchingRuleUse_Compliant() {
mu := mySchema.MatchingRuleUses().Index(3)
fmt.Println(mu.Compliant())
// Output: true
}
/*
This example demonstrates the string representation process for an instance
of [MatchingRuleUse].
Note: this example assumes a legitimate schema variable is defined
in place of the fictional "mySchema" var shown here for simplicity.
*/
func ExampleMatchingRuleUse_String() {
mu := mySchema.MatchingRuleUses().Get(`2.5.13.2`)
fmt.Println(mu)
// Output: ( 2.5.13.2
// NAME 'caseIgnoreMatch'
// APPLIES ( carLicense
// $ departmentNumber
// $ displayName
// $ employeeNumber
// $ employeeType
// $ preferredLanguage
// $ name
// $ businessCategory
// $ description
// $ destinationIndicator
// $ dnQualifier
// $ houseIdentifier
// $ physicalDeliveryOfficeName
// $ postalCode
// $ postOfficeBox
// $ serialNumber
// $ street
// $ uid
// $ buildingName
// $ co
// $ documentIdentifier
// $ documentLocation
// $ documentPublisher
// $ documentTitle
// $ documentVersion
// $ drink
// $ host
// $ info
// $ organizationalStatus
// $ personalTitle
// $ roomNumber
// $ uniqueIdentifier
// $ userClass
// $ uddiBusinessKey
// $ uddiOperator
// $ uddiName
// $ uddiDescription
// $ uddiDiscoveryURLs
// $ uddiUseType
// $ uddiPersonName
// $ uddiPhone
// $ uddiEMail
// $ uddiSortCode
// $ uddiTModelKey
// $ uddiAddressLine
// $ uddiIdentifierBag
// $ uddiCategoryBag
// $ uddiKeyedReference
// $ uddiServiceKey
// $ uddiBindingKey
// $ uddiAccessPoint
// $ uddiHostingRedirector
// $ uddiInstanceDescription
// $ uddiInstanceParms
// $ uddiOverviewDescription
// $ uddiOverviewURL
// $ uddiFromKey
// $ uddiToKey
// $ uddiUUID
// $ uddiLang
// $ uddiv3BusinessKey
// $ uddiv3ServiceKey
// $ uddiv3BindingKey
// $ uddiv3TModelKey
// $ uddiv3NodeId
// $ uddiv3SubscriptionKey
// $ uddiv3SubscriptionFilter
// $ uddiv3NotificationInterval
// $ uddiv3EntityKey
// $ aSN1Notation )
// X-ORIGIN 'RFC4517' )
}
/*
This example demonstrates the act of pushing, or appending, a new instance
of [MatchingRuleUse] into a new [MatchingRuleUses] stack instance.
Note: this example assumes a legitimate schema variable is defined
in place of the fictional "mySchema" var shown here for simplicity.
*/
func ExampleMatchingRuleUses_Push() {
mu := mySchema.MatchingRuleUses().Get(`caseIgnoreMatch`)
myMus := NewMatchingRuleUses()
myMus.Push(mu)
fmt.Println(myMus.Len())
// Output: 1
}
/*
This example demonstrates a means of checking whether a particular instance
of [MatchingRuleUse] is present within an instance of [MatchingRuleUses].
Note: this example assumes a legitimate schema variable is defined
in place of the fictional "mySchema" var shown here for simplicity.
*/
func ExampleMatchingRuleUses_Contains() {
mus := mySchema.MatchingRuleUses()
fmt.Println(mus.Contains(`caseIgnoreMatch`)) // or "2.5.13.2"
// Output: true
}
/*
This example demonstrates the creation of a new [MatchingRuleUse]
instance for manual assembly as an OBSOLETE instance.
Note: this example assumes a legitimate schema variable is defined
in place of the fictional "mySchema" var shown here for simplicity.
*/
func ExampleMatchingRuleUse_SetObsolete() {
var def MatchingRuleUse = NewMatchingRuleUse()
def.SetObsolete()
fmt.Printf("Is obsolete: %t", def.Obsolete())
// Output: Is obsolete: true
}
/*
Do stupid things to make schemax panic, gain additional
coverage in the process.
*/
func TestMatchingRuleUse_codecov(t *testing.T) {
_ = mySchema.MatchingRuleUses().SetStringer().Contains(``)
mySchema.MatchingRuleUses().Push(rune(10))
mySchema.MatchingRuleUses().IsZero()
_ = mySchema.MatchingRuleUses().String()
cim := mySchema.MatchingRuleUses().Get(`caseIgnoreMatch`)
mySchema.MatchingRuleUses().canPush()
mySchema.MatchingRuleUses().canPush(``, ``, ``, ``, cim)
mySchema.MatchingRuleUses().canPush(cim, cim)
bmr := newCollection(``)
MatchingRuleUses(bmr.cast()).Push(NewMatchingRuleUse().SetSchema(mySchema))
MatchingRuleUses(bmr.cast()).Push(NewMatchingRuleUse().SetSchema(mySchema).SetNumericOID(`1.2.3.4.5`))
bmr.cast().Push(NewMatchingRuleUse().SetSchema(mySchema))
bmr.cast().Push(NewMatchingRuleUse().SetSchema(mySchema).SetNumericOID(`1.2.3.4.5`))
MatchingRuleUses(bmr).Push(NewMatchingRuleUse().SetSchema(mySchema))
MatchingRuleUses(bmr).Push(NewMatchingRuleUse().SetSchema(mySchema).SetNumericOID(`1.2.3.4.5`))
MatchingRuleUses(bmr).Compliant()
var def MatchingRuleUse
_ = def.String()
_ = def.SetStringer()
_ = def.Description()
_ = def.Name()
_ = def.Names()
_ = def.Extensions()
_ = def.Applies()
_ = def.Schema()
_ = def.Map()
_ = def.Compliant()
_ = def.macro()
_ = def.Obsolete()
def.setOID(`4.3.2.1`)
var raw string = `( 2.5.13.2 NAME 'caseIgnoreMatch' APPLIES cn X-ORIGIN 'RFC4517' )`
if err := def.Parse(raw); err == nil {
t.Errorf("%s failed: expected parsing incompatibility error, got nothing", t.Name())
return
}
def = NewMatchingRuleUse()
def.SetDescription(`'a`)
def.SetDescription(`'Unnecessary quoted value to be overwritten'`)
// Try again. Properly.
def.SetSchema(mySchema)
if def.Schema().IsZero() {
t.Errorf("%s failed: no schema reference!", t.Name())
return
}
def.setStringer(func() string {
return "blarg"
})
def.SetData(`fake`)
def.SetData(nil)
def.Data()
_ = def.macro()
def.setOID(`2.5.13.2`)
var def2 MatchingRuleUse
_ = def2.Replace(def) // will fail
xx := mySchema.MatchingRuleUses().Get(`caseExactMatch`)
yy := mySchema.MatchingRuleUses().Get(`caseIgnoreMatch`)
yy.Replace(xx)
var oo *matchingRuleUse = new(matchingRuleUse)
var mru MatchingRuleUse = MatchingRuleUse{oo}
name := mySchema.AttributeTypes().Get(`name`)
_ = mySchema.MatchingRuleUses().String()
_ = mySchema.MatchingRuleUses().push(MatchingRuleUse{})
mr := MatchingRule{}
_, _ = mr.makeMatchingRuleUse()
mySchema.updateMatchingRuleUses(AttributeTypes{})
oo.replace(MatchingRuleUse{&matchingRuleUse{schema: mySchema}})
oo.setApplies(`cn`)
oo.setApplies(rune(33), `cn`, nil, MatchingRuleUse{}, AttributeType{}, name)
oo.OID = mySchema.MatchingRules().Get(`caseIgnoreMatch`)
mru.replace(MatchingRuleUse{oo})
mru.SetSchema(mySchema)
_ = mru.Compliant()
mru.setOID(`1.2.3.4.5.6.7`)
mru.macro()
mru.SetStringer()
mru.stringer()
}