How to use coverage class

Best Atoum code snippet using coverage

coverage.pb.go

Source:coverage.pb.go Github

copy

Full Screen

...15// Code generated by protoc-gen-go. DO NOT EDIT.16// versions:17// protoc-gen-go v1.22.018// protoc v3.11.219// source: google/devtools/resultstore/v2/coverage.proto20package resultstore21import (22 reflect "reflect"23 sync "sync"24 proto "github.com/golang/protobuf/proto"25 protoreflect "google.golang.org/protobuf/reflect/protoreflect"26 protoimpl "google.golang.org/protobuf/runtime/protoimpl"27)28const (29 // Verify that this generated code is sufficiently up-to-date.30 _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)31 // Verify that runtime/protoimpl is sufficiently up-to-date.32 _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)33)34// This is a compile-time assertion that a sufficiently up-to-date version35// of the legacy proto package is being used.36const _ = proto.ProtoPackageIsVersion437// Describes line coverage for a file38type LineCoverage struct {39 state protoimpl.MessageState40 sizeCache protoimpl.SizeCache41 unknownFields protoimpl.UnknownFields42 // Which source lines in the file represent the start of a statement that was43 // instrumented to detect whether it was executed by the test.44 //45 // This is a bitfield where i-th bit corresponds to the i-th line. Divide line46 // number by 8 to get index into byte array. Mod line number by 8 to get bit47 // number (0 = LSB, 7 = MSB).48 //49 // A 1 denotes the line was instrumented.50 // A 0 denotes the line was not instrumented.51 InstrumentedLines []byte `protobuf:"bytes,1,opt,name=instrumented_lines,json=instrumentedLines,proto3" json:"instrumented_lines,omitempty"`52 // Which of the instrumented source lines were executed by the test. Should53 // include lines that were not instrumented.54 //55 // This is a bitfield where i-th bit corresponds to the i-th line. Divide line56 // number by 8 to get index into byte array. Mod line number by 8 to get bit57 // number (0 = LSB, 7 = MSB).58 //59 // A 1 denotes the line was executed.60 // A 0 denotes the line was not executed.61 ExecutedLines []byte `protobuf:"bytes,2,opt,name=executed_lines,json=executedLines,proto3" json:"executed_lines,omitempty"`62}63func (x *LineCoverage) Reset() {64 *x = LineCoverage{}65 if protoimpl.UnsafeEnabled {66 mi := &file_google_devtools_resultstore_v2_coverage_proto_msgTypes[0]67 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))68 ms.StoreMessageInfo(mi)69 }70}71func (x *LineCoverage) String() string {72 return protoimpl.X.MessageStringOf(x)73}74func (*LineCoverage) ProtoMessage() {}75func (x *LineCoverage) ProtoReflect() protoreflect.Message {76 mi := &file_google_devtools_resultstore_v2_coverage_proto_msgTypes[0]77 if protoimpl.UnsafeEnabled && x != nil {78 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))79 if ms.LoadMessageInfo() == nil {80 ms.StoreMessageInfo(mi)81 }82 return ms83 }84 return mi.MessageOf(x)85}86// Deprecated: Use LineCoverage.ProtoReflect.Descriptor instead.87func (*LineCoverage) Descriptor() ([]byte, []int) {88 return file_google_devtools_resultstore_v2_coverage_proto_rawDescGZIP(), []int{0}89}90func (x *LineCoverage) GetInstrumentedLines() []byte {91 if x != nil {92 return x.InstrumentedLines93 }94 return nil95}96func (x *LineCoverage) GetExecutedLines() []byte {97 if x != nil {98 return x.ExecutedLines99 }100 return nil101}102// Describes branch coverage for a file103type BranchCoverage struct {104 state protoimpl.MessageState105 sizeCache protoimpl.SizeCache106 unknownFields protoimpl.UnknownFields107 // The field branch_present denotes the lines containing at least one branch.108 //109 // This is a bitfield where i-th bit corresponds to the i-th line. Divide line110 // number by 8 to get index into byte array. Mod line number by 8 to get bit111 // number (0 = LSB, 7 = MSB).112 //113 // A 1 denotes the line contains at least one branch.114 // A 0 denotes the line contains no branches.115 BranchPresent []byte `protobuf:"bytes,1,opt,name=branch_present,json=branchPresent,proto3" json:"branch_present,omitempty"`116 // Contains the number of branches present, only for the lines which have the117 // corresponding bit set in branch_present, in a relative order ignoring118 // lines which do not have any branches.119 BranchesInLine []int32 `protobuf:"varint,2,rep,packed,name=branches_in_line,json=branchesInLine,proto3" json:"branches_in_line,omitempty"`120 // As each branch can have any one of the following three states: not121 // executed, executed but not taken, executed and taken.122 //123 // This is a bitfield where i-th bit corresponds to the i-th branch. Divide124 // branch number by 8 to get index into byte array. Mod branch number by 8 to125 // get bit number (0 = LSB, 7 = MSB).126 //127 // i-th bit of the following two byte arrays are used to denote the above128 // mentioned states.129 //130 // not executed: i-th bit of executed == 0 && i-th bit of taken == 0131 // executed but not taken: i-th bit of executed == 1 && i-th bit of taken == 0132 // executed and taken: i-th bit of executed == 1 && i-th bit of taken == 1133 Executed []byte `protobuf:"bytes,3,opt,name=executed,proto3" json:"executed,omitempty"`134 // Described above.135 Taken []byte `protobuf:"bytes,4,opt,name=taken,proto3" json:"taken,omitempty"`136}137func (x *BranchCoverage) Reset() {138 *x = BranchCoverage{}139 if protoimpl.UnsafeEnabled {140 mi := &file_google_devtools_resultstore_v2_coverage_proto_msgTypes[1]141 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))142 ms.StoreMessageInfo(mi)143 }144}145func (x *BranchCoverage) String() string {146 return protoimpl.X.MessageStringOf(x)147}148func (*BranchCoverage) ProtoMessage() {}149func (x *BranchCoverage) ProtoReflect() protoreflect.Message {150 mi := &file_google_devtools_resultstore_v2_coverage_proto_msgTypes[1]151 if protoimpl.UnsafeEnabled && x != nil {152 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))153 if ms.LoadMessageInfo() == nil {154 ms.StoreMessageInfo(mi)155 }156 return ms157 }158 return mi.MessageOf(x)159}160// Deprecated: Use BranchCoverage.ProtoReflect.Descriptor instead.161func (*BranchCoverage) Descriptor() ([]byte, []int) {162 return file_google_devtools_resultstore_v2_coverage_proto_rawDescGZIP(), []int{1}163}164func (x *BranchCoverage) GetBranchPresent() []byte {165 if x != nil {166 return x.BranchPresent167 }168 return nil169}170func (x *BranchCoverage) GetBranchesInLine() []int32 {171 if x != nil {172 return x.BranchesInLine173 }174 return nil175}176func (x *BranchCoverage) GetExecuted() []byte {177 if x != nil {178 return x.Executed179 }180 return nil181}182func (x *BranchCoverage) GetTaken() []byte {183 if x != nil {184 return x.Taken185 }186 return nil187}188// Describes code coverage for a particular file under test.189type FileCoverage struct {190 state protoimpl.MessageState191 sizeCache protoimpl.SizeCache192 unknownFields protoimpl.UnknownFields193 // Path of source file within the SourceContext of this Invocation.194 Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`195 // Details of lines in a file required to calculate line coverage.196 LineCoverage *LineCoverage `protobuf:"bytes,2,opt,name=line_coverage,json=lineCoverage,proto3" json:"line_coverage,omitempty"`197 // Details of branches in a file required to calculate branch coverage.198 BranchCoverage *BranchCoverage `protobuf:"bytes,3,opt,name=branch_coverage,json=branchCoverage,proto3" json:"branch_coverage,omitempty"`199}200func (x *FileCoverage) Reset() {201 *x = FileCoverage{}202 if protoimpl.UnsafeEnabled {203 mi := &file_google_devtools_resultstore_v2_coverage_proto_msgTypes[2]204 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))205 ms.StoreMessageInfo(mi)206 }207}208func (x *FileCoverage) String() string {209 return protoimpl.X.MessageStringOf(x)210}211func (*FileCoverage) ProtoMessage() {}212func (x *FileCoverage) ProtoReflect() protoreflect.Message {213 mi := &file_google_devtools_resultstore_v2_coverage_proto_msgTypes[2]214 if protoimpl.UnsafeEnabled && x != nil {215 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))216 if ms.LoadMessageInfo() == nil {217 ms.StoreMessageInfo(mi)218 }219 return ms220 }221 return mi.MessageOf(x)222}223// Deprecated: Use FileCoverage.ProtoReflect.Descriptor instead.224func (*FileCoverage) Descriptor() ([]byte, []int) {225 return file_google_devtools_resultstore_v2_coverage_proto_rawDescGZIP(), []int{2}226}227func (x *FileCoverage) GetPath() string {228 if x != nil {229 return x.Path230 }231 return ""232}233func (x *FileCoverage) GetLineCoverage() *LineCoverage {234 if x != nil {235 return x.LineCoverage236 }237 return nil238}239func (x *FileCoverage) GetBranchCoverage() *BranchCoverage {240 if x != nil {241 return x.BranchCoverage242 }243 return nil244}245// Describes code coverage for a build or test Action. This is used to store246// baseline coverage for build Actions and test coverage for test Actions.247type ActionCoverage struct {248 state protoimpl.MessageState249 sizeCache protoimpl.SizeCache250 unknownFields protoimpl.UnknownFields251 // List of coverage info for all source files that the TestResult covers.252 FileCoverages []*FileCoverage `protobuf:"bytes,2,rep,name=file_coverages,json=fileCoverages,proto3" json:"file_coverages,omitempty"`253}254func (x *ActionCoverage) Reset() {255 *x = ActionCoverage{}256 if protoimpl.UnsafeEnabled {257 mi := &file_google_devtools_resultstore_v2_coverage_proto_msgTypes[3]258 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))259 ms.StoreMessageInfo(mi)260 }261}262func (x *ActionCoverage) String() string {263 return protoimpl.X.MessageStringOf(x)264}265func (*ActionCoverage) ProtoMessage() {}266func (x *ActionCoverage) ProtoReflect() protoreflect.Message {267 mi := &file_google_devtools_resultstore_v2_coverage_proto_msgTypes[3]268 if protoimpl.UnsafeEnabled && x != nil {269 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))270 if ms.LoadMessageInfo() == nil {271 ms.StoreMessageInfo(mi)272 }273 return ms274 }275 return mi.MessageOf(x)276}277// Deprecated: Use ActionCoverage.ProtoReflect.Descriptor instead.278func (*ActionCoverage) Descriptor() ([]byte, []int) {279 return file_google_devtools_resultstore_v2_coverage_proto_rawDescGZIP(), []int{3}280}281func (x *ActionCoverage) GetFileCoverages() []*FileCoverage {282 if x != nil {283 return x.FileCoverages284 }285 return nil286}287// Describes aggregate code coverage for a collection of build or test Actions.288// A line or branch is covered if and only if it is covered in any of the build289// or test actions.290type AggregateCoverage struct {291 state protoimpl.MessageState292 sizeCache protoimpl.SizeCache293 unknownFields protoimpl.UnknownFields294 // Aggregated coverage info for all source files that the actions cover.295 FileCoverages []*FileCoverage `protobuf:"bytes,1,rep,name=file_coverages,json=fileCoverages,proto3" json:"file_coverages,omitempty"`296}297func (x *AggregateCoverage) Reset() {298 *x = AggregateCoverage{}299 if protoimpl.UnsafeEnabled {300 mi := &file_google_devtools_resultstore_v2_coverage_proto_msgTypes[4]301 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))302 ms.StoreMessageInfo(mi)303 }304}305func (x *AggregateCoverage) String() string {306 return protoimpl.X.MessageStringOf(x)307}308func (*AggregateCoverage) ProtoMessage() {}309func (x *AggregateCoverage) ProtoReflect() protoreflect.Message {310 mi := &file_google_devtools_resultstore_v2_coverage_proto_msgTypes[4]311 if protoimpl.UnsafeEnabled && x != nil {312 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))313 if ms.LoadMessageInfo() == nil {314 ms.StoreMessageInfo(mi)315 }316 return ms317 }318 return mi.MessageOf(x)319}320// Deprecated: Use AggregateCoverage.ProtoReflect.Descriptor instead.321func (*AggregateCoverage) Descriptor() ([]byte, []int) {322 return file_google_devtools_resultstore_v2_coverage_proto_rawDescGZIP(), []int{4}323}324func (x *AggregateCoverage) GetFileCoverages() []*FileCoverage {325 if x != nil {326 return x.FileCoverages327 }328 return nil329}330var File_google_devtools_resultstore_v2_coverage_proto protoreflect.FileDescriptor331var file_google_devtools_resultstore_v2_coverage_proto_rawDesc = []byte{332 0x0a, 0x2d, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x64, 0x65, 0x76, 0x74, 0x6f, 0x6f, 0x6c,333 0x73, 0x2f, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x32,334 0x2f, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,335 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x64, 0x65, 0x76, 0x74, 0x6f, 0x6f, 0x6c, 0x73,336 0x2e, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x32, 0x22,337 0x64, 0x0a, 0x0c, 0x4c, 0x69, 0x6e, 0x65, 0x43, 0x6f, 0x76, 0x65, 0x72, 0x61, 0x67, 0x65, 0x12,338 0x2d, 0x0a, 0x12, 0x69, 0x6e, 0x73, 0x74, 0x72, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x65, 0x64, 0x5f,339 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x11, 0x69, 0x6e, 0x73,340 0x74, 0x72, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x65, 0x64, 0x4c, 0x69, 0x6e, 0x65, 0x73, 0x12, 0x25,341 0x0a, 0x0e, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x64, 0x5f, 0x6c, 0x69, 0x6e, 0x65, 0x73,342 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0d, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x64,343 0x4c, 0x69, 0x6e, 0x65, 0x73, 0x22, 0x93, 0x01, 0x0a, 0x0e, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68,344 0x43, 0x6f, 0x76, 0x65, 0x72, 0x61, 0x67, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x62, 0x72, 0x61, 0x6e,345 0x63, 0x68, 0x5f, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c,346 0x52, 0x0d, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x50, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x12,347 0x28, 0x0a, 0x10, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x65, 0x73, 0x5f, 0x69, 0x6e, 0x5f, 0x6c,348 0x69, 0x6e, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x05, 0x52, 0x0e, 0x62, 0x72, 0x61, 0x6e, 0x63,349 0x68, 0x65, 0x73, 0x49, 0x6e, 0x4c, 0x69, 0x6e, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x78, 0x65,350 0x63, 0x75, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x65, 0x78, 0x65,351 0x63, 0x75, 0x74, 0x65, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x61, 0x6b, 0x65, 0x6e, 0x18, 0x04,352 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x74, 0x61, 0x6b, 0x65, 0x6e, 0x22, 0xce, 0x01, 0x0a, 0x0c,353 0x46, 0x69, 0x6c, 0x65, 0x43, 0x6f, 0x76, 0x65, 0x72, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04,354 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68,355 0x12, 0x51, 0x0a, 0x0d, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x61, 0x67,356 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,357 0x2e, 0x64, 0x65, 0x76, 0x74, 0x6f, 0x6f, 0x6c, 0x73, 0x2e, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74,358 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x32, 0x2e, 0x4c, 0x69, 0x6e, 0x65, 0x43, 0x6f, 0x76,359 0x65, 0x72, 0x61, 0x67, 0x65, 0x52, 0x0c, 0x6c, 0x69, 0x6e, 0x65, 0x43, 0x6f, 0x76, 0x65, 0x72,360 0x61, 0x67, 0x65, 0x12, 0x57, 0x0a, 0x0f, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x5f, 0x63, 0x6f,361 0x76, 0x65, 0x72, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x67,362 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x64, 0x65, 0x76, 0x74, 0x6f, 0x6f, 0x6c, 0x73, 0x2e, 0x72,363 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x32, 0x2e, 0x42, 0x72,364 0x61, 0x6e, 0x63, 0x68, 0x43, 0x6f, 0x76, 0x65, 0x72, 0x61, 0x67, 0x65, 0x52, 0x0e, 0x62, 0x72,365 0x61, 0x6e, 0x63, 0x68, 0x43, 0x6f, 0x76, 0x65, 0x72, 0x61, 0x67, 0x65, 0x22, 0x65, 0x0a, 0x0e,366 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x76, 0x65, 0x72, 0x61, 0x67, 0x65, 0x12, 0x53,367 0x0a, 0x0e, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x61, 0x67, 0x65, 0x73,368 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,369 0x64, 0x65, 0x76, 0x74, 0x6f, 0x6f, 0x6c, 0x73, 0x2e, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73,370 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x32, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x43, 0x6f, 0x76, 0x65,371 0x72, 0x61, 0x67, 0x65, 0x52, 0x0d, 0x66, 0x69, 0x6c, 0x65, 0x43, 0x6f, 0x76, 0x65, 0x72, 0x61,372 0x67, 0x65, 0x73, 0x22, 0x68, 0x0a, 0x11, 0x41, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65,373 0x43, 0x6f, 0x76, 0x65, 0x72, 0x61, 0x67, 0x65, 0x12, 0x53, 0x0a, 0x0e, 0x66, 0x69, 0x6c, 0x65,374 0x5f, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x61, 0x67, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b,375 0x32, 0x2c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x64, 0x65, 0x76, 0x74, 0x6f, 0x6f,376 0x6c, 0x73, 0x2e, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76,377 0x32, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x43, 0x6f, 0x76, 0x65, 0x72, 0x61, 0x67, 0x65, 0x52, 0x0d,378 0x66, 0x69, 0x6c, 0x65, 0x43, 0x6f, 0x76, 0x65, 0x72, 0x61, 0x67, 0x65, 0x73, 0x42, 0x71, 0x0a,379 0x22, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x64, 0x65, 0x76, 0x74,380 0x6f, 0x6f, 0x6c, 0x73, 0x2e, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x74, 0x6f, 0x72, 0x65,381 0x2e, 0x76, 0x32, 0x50, 0x01, 0x5a, 0x49, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f,382 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x67, 0x65, 0x6e, 0x70, 0x72, 0x6f, 0x74,383 0x6f, 0x2f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x64, 0x65, 0x76,384 0x74, 0x6f, 0x6f, 0x6c, 0x73, 0x2f, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x74, 0x6f, 0x72,385 0x65, 0x2f, 0x76, 0x32, 0x3b, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x74, 0x6f, 0x72, 0x65,386 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,387}388var (389 file_google_devtools_resultstore_v2_coverage_proto_rawDescOnce sync.Once390 file_google_devtools_resultstore_v2_coverage_proto_rawDescData = file_google_devtools_resultstore_v2_coverage_proto_rawDesc391)392func file_google_devtools_resultstore_v2_coverage_proto_rawDescGZIP() []byte {393 file_google_devtools_resultstore_v2_coverage_proto_rawDescOnce.Do(func() {394 file_google_devtools_resultstore_v2_coverage_proto_rawDescData = protoimpl.X.CompressGZIP(file_google_devtools_resultstore_v2_coverage_proto_rawDescData)395 })396 return file_google_devtools_resultstore_v2_coverage_proto_rawDescData397}398var file_google_devtools_resultstore_v2_coverage_proto_msgTypes = make([]protoimpl.MessageInfo, 5)399var file_google_devtools_resultstore_v2_coverage_proto_goTypes = []interface{}{400 (*LineCoverage)(nil), // 0: google.devtools.resultstore.v2.LineCoverage401 (*BranchCoverage)(nil), // 1: google.devtools.resultstore.v2.BranchCoverage402 (*FileCoverage)(nil), // 2: google.devtools.resultstore.v2.FileCoverage403 (*ActionCoverage)(nil), // 3: google.devtools.resultstore.v2.ActionCoverage404 (*AggregateCoverage)(nil), // 4: google.devtools.resultstore.v2.AggregateCoverage405}406var file_google_devtools_resultstore_v2_coverage_proto_depIdxs = []int32{407 0, // 0: google.devtools.resultstore.v2.FileCoverage.line_coverage:type_name -> google.devtools.resultstore.v2.LineCoverage408 1, // 1: google.devtools.resultstore.v2.FileCoverage.branch_coverage:type_name -> google.devtools.resultstore.v2.BranchCoverage409 2, // 2: google.devtools.resultstore.v2.ActionCoverage.file_coverages:type_name -> google.devtools.resultstore.v2.FileCoverage410 2, // 3: google.devtools.resultstore.v2.AggregateCoverage.file_coverages:type_name -> google.devtools.resultstore.v2.FileCoverage411 4, // [4:4] is the sub-list for method output_type412 4, // [4:4] is the sub-list for method input_type413 4, // [4:4] is the sub-list for extension type_name414 4, // [4:4] is the sub-list for extension extendee415 0, // [0:4] is the sub-list for field type_name416}417func init() { file_google_devtools_resultstore_v2_coverage_proto_init() }418func file_google_devtools_resultstore_v2_coverage_proto_init() {419 if File_google_devtools_resultstore_v2_coverage_proto != nil {420 return421 }422 if !protoimpl.UnsafeEnabled {423 file_google_devtools_resultstore_v2_coverage_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {424 switch v := v.(*LineCoverage); i {425 case 0:426 return &v.state427 case 1:428 return &v.sizeCache429 case 2:430 return &v.unknownFields431 default:432 return nil433 }434 }435 file_google_devtools_resultstore_v2_coverage_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {436 switch v := v.(*BranchCoverage); i {437 case 0:438 return &v.state439 case 1:440 return &v.sizeCache441 case 2:442 return &v.unknownFields443 default:444 return nil445 }446 }447 file_google_devtools_resultstore_v2_coverage_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {448 switch v := v.(*FileCoverage); i {449 case 0:450 return &v.state451 case 1:452 return &v.sizeCache453 case 2:454 return &v.unknownFields455 default:456 return nil457 }458 }459 file_google_devtools_resultstore_v2_coverage_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {460 switch v := v.(*ActionCoverage); i {461 case 0:462 return &v.state463 case 1:464 return &v.sizeCache465 case 2:466 return &v.unknownFields467 default:468 return nil469 }470 }471 file_google_devtools_resultstore_v2_coverage_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {472 switch v := v.(*AggregateCoverage); i {473 case 0:474 return &v.state475 case 1:476 return &v.sizeCache477 case 2:478 return &v.unknownFields479 default:480 return nil481 }482 }483 }484 type x struct{}485 out := protoimpl.TypeBuilder{486 File: protoimpl.DescBuilder{487 GoPackagePath: reflect.TypeOf(x{}).PkgPath(),488 RawDescriptor: file_google_devtools_resultstore_v2_coverage_proto_rawDesc,489 NumEnums: 0,490 NumMessages: 5,491 NumExtensions: 0,492 NumServices: 0,493 },494 GoTypes: file_google_devtools_resultstore_v2_coverage_proto_goTypes,495 DependencyIndexes: file_google_devtools_resultstore_v2_coverage_proto_depIdxs,496 MessageInfos: file_google_devtools_resultstore_v2_coverage_proto_msgTypes,497 }.Build()498 File_google_devtools_resultstore_v2_coverage_proto = out.File499 file_google_devtools_resultstore_v2_coverage_proto_rawDesc = nil500 file_google_devtools_resultstore_v2_coverage_proto_goTypes = nil501 file_google_devtools_resultstore_v2_coverage_proto_depIdxs = nil502}...

Full Screen

Full Screen

CodeCoverageTest_1.php

Source:CodeCoverageTest_1.php Github

copy

Full Screen

...39 * @subpackage Tests40 * @author Sebastian Bergmann <sebastian@phpunit.de>41 * @copyright 2009-2014 Sebastian Bergmann <sebastian@phpunit.de>42 * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License43 * @link http://github.com/sebastianbergmann/php-code-coverage44 * @since File available since Release 1.0.045 */46if (!defined('TEST_FILES_PATH')) {47 define(48 'TEST_FILES_PATH',49 dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR .50 '_files' . DIRECTORY_SEPARATOR51 );52}53require_once TEST_FILES_PATH . '../TestCase.php';54require_once TEST_FILES_PATH . 'BankAccount.php';55require_once TEST_FILES_PATH . 'BankAccountTest.php';56/**57 * Tests for the PHP_CodeCoverage class.58 *59 * @category PHP60 * @package CodeCoverage61 * @subpackage Tests62 * @author Sebastian Bergmann <sebastian@phpunit.de>63 * @copyright 2009-2014 Sebastian Bergmann <sebastian@phpunit.de>64 * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License65 * @link http://github.com/sebastianbergmann/php-code-coverage66 * @since Class available since Release 1.0.067 */68class PHP_CodeCoverageTest extends PHP_CodeCoverage_TestCase69{70 protected $coverage;71 protected $getLinesToBeCovered;72 protected function setUp()73 {74 $this->coverage = new PHP_CodeCoverage;75 $this->getLinesToBeCovered = new ReflectionMethod(76 'PHP_CodeCoverage', 'getLinesToBeCovered'77 );78 $this->getLinesToBeCovered->setAccessible(TRUE);79 }80 /**81 * @covers PHP_CodeCoverage::__construct82 * @covers PHP_CodeCoverage::filter83 */84 public function testConstructor()85 {86 $this->assertAttributeInstanceOf(87 'PHP_CodeCoverage_Driver_Xdebug', 'driver', $this->coverage88 );89 $this->assertAttributeInstanceOf(90 'PHP_CodeCoverage_Filter', 'filter', $this->coverage91 );92 }93 /**94 * @covers PHP_CodeCoverage::__construct95 * @covers PHP_CodeCoverage::filter96 */97 public function testConstructor2()98 {99 $filter = new PHP_CodeCoverage_Filter;100 $coverage = new PHP_CodeCoverage(NULL, $filter);101 $this->assertAttributeInstanceOf(102 'PHP_CodeCoverage_Driver_Xdebug', 'driver', $coverage103 );104 $this->assertSame($filter, $coverage->filter());105 }106 /**107 * @covers PHP_CodeCoverage::start108 * @expectedException PHP_CodeCoverage_Exception109 */110 public function testStartThrowsExceptionForInvalidArgument()111 {112 $this->coverage->start(NULL, array(), NULL);113 }114 /**115 * @covers PHP_CodeCoverage::stop116 * @expectedException PHP_CodeCoverage_Exception117 */118 public function testStopThrowsExceptionForInvalidArgument()119 {120 $this->coverage->stop(NULL);121 }122 /**123 * @covers PHP_CodeCoverage::append124 * @expectedException PHP_CodeCoverage_Exception125 */126 public function testAppendThrowsExceptionForInvalidArgument()127 {128 $this->coverage->append(array(), NULL);129 }130 /**131 * @covers PHP_CodeCoverage::setCacheTokens132 * @expectedException PHP_CodeCoverage_Exception133 */134 public function testSetCacheTokensThrowsExceptionForInvalidArgument()135 {136 $this->coverage->setCacheTokens(NULL);137 }138 /**139 * @covers PHP_CodeCoverage::setCacheTokens140 */141 public function testSetCacheTokens()142 {143 $this->coverage->setCacheTokens(TRUE);144 $this->assertAttributeEquals(TRUE, 'cacheTokens', $this->coverage);145 }146 /**147 * @covers PHP_CodeCoverage::setForceCoversAnnotation148 * @expectedException PHP_CodeCoverage_Exception149 */150 public function testSetForceCoversAnnotationThrowsExceptionForInvalidArgument()151 {152 $this->coverage->setForceCoversAnnotation(NULL);153 }154 /**155 * @covers PHP_CodeCoverage::setForceCoversAnnotation156 */157 public function testSetForceCoversAnnotation()158 {159 $this->coverage->setForceCoversAnnotation(TRUE);160 $this->assertAttributeEquals(161 TRUE, 'forceCoversAnnotation', $this->coverage162 );163 }164 /**165 * @covers PHP_CodeCoverage::setProcessUncoveredFilesFromWhitelist166 * @expectedException PHP_CodeCoverage_Exception167 */168 public function testSetProcessUncoveredFilesFromWhitelistThrowsExceptionForInvalidArgument()169 {170 $this->coverage->setProcessUncoveredFilesFromWhitelist(NULL);171 }172 /**173 * @covers PHP_CodeCoverage::setProcessUncoveredFilesFromWhitelist174 */175 public function testSetProcessUncoveredFilesFromWhitelist()176 {177 $this->coverage->setProcessUncoveredFilesFromWhitelist(TRUE);178 $this->assertAttributeEquals(179 TRUE, 'processUncoveredFilesFromWhitelist', $this->coverage180 );181 }182 /**183 * @covers PHP_CodeCoverage::setMapTestClassNameToCoveredClassName184 */185 public function testSetMapTestClassNameToCoveredClassName()186 {187 $this->coverage->setMapTestClassNameToCoveredClassName(TRUE);188 $this->assertAttributeEquals(189 TRUE, 'mapTestClassNameToCoveredClassName', $this->coverage190 );191 }192 /**193 * @covers PHP_CodeCoverage::setMapTestClassNameToCoveredClassName194 * @expectedException PHP_CodeCoverage_Exception195 */196 public function testSetMapTestClassNameToCoveredClassNameThrowsExceptionForInvalidArgument()197 {198 $this->coverage->setMapTestClassNameToCoveredClassName(NULL);199 }200 /**201 * @covers PHP_CodeCoverage::clear202 */203 public function testClear()204 {205 $this->coverage->clear();206 $this->assertAttributeEquals(NULL, 'currentId', $this->coverage);207 $this->assertAttributeEquals(array(), 'data', $this->coverage);208 $this->assertAttributeEquals(array(), 'tests', $this->coverage);209 }210 /**211 * @covers PHP_CodeCoverage::start212 * @covers PHP_CodeCoverage::stop213 * @covers PHP_CodeCoverage::append214 * @covers PHP_CodeCoverage::applyListsFilter215 * @covers PHP_CodeCoverage::initializeFilesThatAreSeenTheFirstTime216 * @covers PHP_CodeCoverage::applyCoversAnnotationFilter217 * @covers PHP_CodeCoverage::getTests218 */219 public function testCollect()220 {221 $coverage = $this->getCoverageForBankAccount();222 $this->assertEquals(223 $this->getExpectedDataArrayForBankAccount(), $coverage->getData()224 );225 $this->assertEquals(226 array(227 'BankAccountTest::testBalanceIsInitiallyZero' => NULL,228 'BankAccountTest::testBalanceCannotBecomeNegative' => NULL,229 'BankAccountTest::testBalanceCannotBecomeNegative2' => NULL,230 'BankAccountTest::testDepositWithdrawMoney' => NULL231 ),232 $coverage->getTests()233 );234 }235 /**236 * @covers PHP_CodeCoverage::getData237 * @covers PHP_CodeCoverage::merge238 */239 public function testMerge()240 {241 $coverage = $this->getCoverageForBankAccountForFirstTwoTests();242 $coverage->merge($this->getCoverageForBankAccountForLastTwoTests());243 $this->assertEquals(244 $this->getExpectedDataArrayForBankAccount(), $coverage->getData()245 );246 }247 /**248 * @covers PHP_CodeCoverage::getData249 * @covers PHP_CodeCoverage::merge250 */251 public function testMerge2()252 {253 $coverage = new PHP_CodeCoverage(254 $this->getMock('PHP_CodeCoverage_Driver_Xdebug'),255 new PHP_CodeCoverage_Filter256 );257 $coverage->merge($this->getCoverageForBankAccount());258 $this->assertEquals(259 $this->getExpectedDataArrayForBankAccount(), $coverage->getData()260 );261 }262 /**263 * @covers PHP_CodeCoverage::getLinesToBeCovered264 * @covers PHP_CodeCoverage::resolveCoversToReflectionObjects265 * @dataProvider getLinesToBeCoveredProvider266 */267 public function testGetLinesToBeCovered($test, $lines)268 {269 if (strpos($test, 'Namespace') === 0) {270 $expected = array(271 TEST_FILES_PATH . 'NamespaceCoveredClass.php' => $lines272 );273 }274 else if ($test === 'CoverageNoneTest') {275 $expected = array();276 }277 else if ($test === 'CoverageNothingTest') {278 $expected = false;279 }280 else if ($test === 'CoverageFunctionTest') {281 $expected = array(282 TEST_FILES_PATH . 'CoveredFunction.php' => $lines283 );284 }285 else {286 $expected = array(TEST_FILES_PATH . 'CoveredClass.php' => $lines);287 }288 $this->assertEquals(289 $expected,290 $this->getLinesToBeCovered->invoke(291 $this->coverage, $test, 'testSomething'292 )293 );294 }295 /**296 * @covers PHP_CodeCoverage::getLinesToBeCovered297 * @covers PHP_CodeCoverage::resolveCoversToReflectionObjects298 * @expectedException PHP_CodeCoverage_Exception299 */300 public function testGetLinesToBeCovered2()301 {302 $this->getLinesToBeCovered->invoke(303 $this->coverage, 'NotExistingCoveredElementTest', 'testOne'304 );305 }306 /**307 * @covers PHP_CodeCoverage::getLinesToBeCovered308 * @covers PHP_CodeCoverage::resolveCoversToReflectionObjects309 * @expectedException PHP_CodeCoverage_Exception310 */311 public function testGetLinesToBeCovered3()312 {313 $this->getLinesToBeCovered->invoke(314 $this->coverage, 'NotExistingCoveredElementTest', 'testTwo'315 );316 }317 /**318 * @covers PHP_CodeCoverage::getLinesToBeCovered319 * @covers PHP_CodeCoverage::resolveCoversToReflectionObjects320 * @expectedException PHP_CodeCoverage_Exception321 */322 public function testGetLinesToBeCovered4()323 {324 $this->getLinesToBeCovered->invoke(325 $this->coverage, 'NotExistingCoveredElementTest', 'testThree'326 );327 }328 /**329 * @covers PHP_CodeCoverage::getLinesToBeCovered330 */331 public function testGetLinesToBeCoveredSkipsNonExistantMethods()332 {333 $this->assertSame(334 array(),335 $this->getLinesToBeCovered->invoke(336 $this->coverage,337 'NotExistingCoveredElementTest',338 'methodDoesNotExist'339 )340 );341 }342 /**343 * @covers PHP_CodeCoverage::getLinesToBeCovered344 * @expectedException PHP_CodeCoverage_Exception345 */346 public function testTwoCoversDefaultClassAnnoationsAreNotAllowed()347 {348 $this->getLinesToBeCovered->invoke(349 $this->coverage,350 'CoverageTwoDefaultClassAnnotations',351 'testSomething'352 );353 }354 /**355 * @covers PHP_CodeCoverage::getLinesToBeCovered356 */357 public function testFunctionParenthesesAreAllowed()358 {359 $this->assertSame(360 array(TEST_FILES_PATH . 'CoveredFunction.php' => range(2, 4)),361 $this->getLinesToBeCovered->invoke(362 $this->coverage,363 'CoverageFunctionParenthesesTest',364 'testSomething'365 )366 );367 }368 /**369 * @covers PHP_CodeCoverage::getLinesToBeCovered370 */371 public function testFunctionParenthesesAreAllowedWithWhitespace()372 {373 $this->assertSame(374 array(TEST_FILES_PATH . 'CoveredFunction.php' => range(2, 4)),375 $this->getLinesToBeCovered->invoke(376 $this->coverage,377 'CoverageFunctionParenthesesWhitespaceTest',378 'testSomething'379 )380 );381 }382 /**383 * @covers PHP_CodeCoverage::getLinesToBeCovered384 */385 public function testMethodParenthesesAreAllowed()386 {387 $this->assertSame(388 array(TEST_FILES_PATH . 'CoveredClass.php' => range(31, 35)),389 $this->getLinesToBeCovered->invoke(390 $this->coverage,391 'CoverageMethodParenthesesTest',392 'testSomething'393 )394 );395 }396 /**397 * @covers PHP_CodeCoverage::getLinesToBeCovered398 */399 public function testMethodParenthesesAreAllowedWithWhitespace()400 {401 $this->assertSame(402 array(TEST_FILES_PATH . 'CoveredClass.php' => range(31, 35)),403 $this->getLinesToBeCovered->invoke(404 $this->coverage,405 'CoverageMethodParenthesesWhitespaceTest',406 'testSomething'407 )408 );409 }410 public function getLinesToBeCoveredProvider()411 {412 return array(413 array(414 'CoverageNoneTest',415 array()416 ),417 array(418 'CoverageClassExtendedTest',...

Full Screen

Full Screen

CodeCoverageTest.php

Source:CodeCoverageTest.php Github

copy

Full Screen

...39 * @subpackage Tests40 * @author Sebastian Bergmann <sebastian@phpunit.de>41 * @copyright 2009-2014 Sebastian Bergmann <sebastian@phpunit.de>42 * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License43 * @link http://github.com/sebastianbergmann/php-code-coverage44 * @since File available since Release 1.0.045 */46if (!defined('TEST_FILES_PATH')) {47 define(48 'TEST_FILES_PATH',49 dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR .50 '_files' . DIRECTORY_SEPARATOR51 );52}53require_once TEST_FILES_PATH . '../TestCase.php';54require_once TEST_FILES_PATH . 'BankAccount.php';55require_once TEST_FILES_PATH . 'BankAccountTest.php';56/**57 * Tests for the PHP_CodeCoverage class.58 *59 * @category PHP60 * @package CodeCoverage61 * @subpackage Tests62 * @author Sebastian Bergmann <sebastian@phpunit.de>63 * @copyright 2009-2014 Sebastian Bergmann <sebastian@phpunit.de>64 * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License65 * @link http://github.com/sebastianbergmann/php-code-coverage66 * @since Class available since Release 1.0.067 */68class PHP_CodeCoverageTest extends PHP_CodeCoverage_TestCase69{70 protected $coverage;71 protected $getLinesToBeCovered;72 protected function setUp()73 {74 $this->coverage = new PHP_CodeCoverage;75 $this->getLinesToBeCovered = new ReflectionMethod(76 'PHP_CodeCoverage', 'getLinesToBeCovered'77 );78 $this->getLinesToBeCovered->setAccessible(TRUE);79 }80 /**81 * @covers PHP_CodeCoverage::__construct82 * @covers PHP_CodeCoverage::filter83 */84 public function testConstructor()85 {86 $this->assertAttributeInstanceOf(87 'PHP_CodeCoverage_Driver_Xdebug', 'driver', $this->coverage88 );89 $this->assertAttributeInstanceOf(90 'PHP_CodeCoverage_Filter', 'filter', $this->coverage91 );92 }93 /**94 * @covers PHP_CodeCoverage::__construct95 * @covers PHP_CodeCoverage::filter96 */97 public function testConstructor2()98 {99 $filter = new PHP_CodeCoverage_Filter;100 $coverage = new PHP_CodeCoverage(NULL, $filter);101 $this->assertAttributeInstanceOf(102 'PHP_CodeCoverage_Driver_Xdebug', 'driver', $coverage103 );104 $this->assertSame($filter, $coverage->filter());105 }106 /**107 * @covers PHP_CodeCoverage::start108 * @expectedException PHP_CodeCoverage_Exception109 */110 public function testStartThrowsExceptionForInvalidArgument()111 {112 $this->coverage->start(NULL, array(), NULL);113 }114 /**115 * @covers PHP_CodeCoverage::stop116 * @expectedException PHP_CodeCoverage_Exception117 */118 public function testStopThrowsExceptionForInvalidArgument()119 {120 $this->coverage->stop(NULL);121 }122 /**123 * @covers PHP_CodeCoverage::append124 * @expectedException PHP_CodeCoverage_Exception125 */126 public function testAppendThrowsExceptionForInvalidArgument()127 {128 $this->coverage->append(array(), NULL);129 }130 /**131 * @covers PHP_CodeCoverage::setCacheTokens132 * @expectedException PHP_CodeCoverage_Exception133 */134 public function testSetCacheTokensThrowsExceptionForInvalidArgument()135 {136 $this->coverage->setCacheTokens(NULL);137 }138 /**139 * @covers PHP_CodeCoverage::setCacheTokens140 */141 public function testSetCacheTokens()142 {143 $this->coverage->setCacheTokens(TRUE);144 $this->assertAttributeEquals(TRUE, 'cacheTokens', $this->coverage);145 }146 /**147 * @covers PHP_CodeCoverage::setForceCoversAnnotation148 * @expectedException PHP_CodeCoverage_Exception149 */150 public function testSetForceCoversAnnotationThrowsExceptionForInvalidArgument()151 {152 $this->coverage->setForceCoversAnnotation(NULL);153 }154 /**155 * @covers PHP_CodeCoverage::setForceCoversAnnotation156 */157 public function testSetForceCoversAnnotation()158 {159 $this->coverage->setForceCoversAnnotation(TRUE);160 $this->assertAttributeEquals(161 TRUE, 'forceCoversAnnotation', $this->coverage162 );163 }164 /**165 * @covers PHP_CodeCoverage::setProcessUncoveredFilesFromWhitelist166 * @expectedException PHP_CodeCoverage_Exception167 */168 public function testSetProcessUncoveredFilesFromWhitelistThrowsExceptionForInvalidArgument()169 {170 $this->coverage->setProcessUncoveredFilesFromWhitelist(NULL);171 }172 /**173 * @covers PHP_CodeCoverage::setProcessUncoveredFilesFromWhitelist174 */175 public function testSetProcessUncoveredFilesFromWhitelist()176 {177 $this->coverage->setProcessUncoveredFilesFromWhitelist(TRUE);178 $this->assertAttributeEquals(179 TRUE, 'processUncoveredFilesFromWhitelist', $this->coverage180 );181 }182 /**183 * @covers PHP_CodeCoverage::setMapTestClassNameToCoveredClassName184 */185 public function testSetMapTestClassNameToCoveredClassName()186 {187 $this->coverage->setMapTestClassNameToCoveredClassName(TRUE);188 $this->assertAttributeEquals(189 TRUE, 'mapTestClassNameToCoveredClassName', $this->coverage190 );191 }192 /**193 * @covers PHP_CodeCoverage::setMapTestClassNameToCoveredClassName194 * @expectedException PHP_CodeCoverage_Exception195 */196 public function testSetMapTestClassNameToCoveredClassNameThrowsExceptionForInvalidArgument()197 {198 $this->coverage->setMapTestClassNameToCoveredClassName(NULL);199 }200 /**201 * @covers PHP_CodeCoverage::clear202 */203 public function testClear()204 {205 $this->coverage->clear();206 $this->assertAttributeEquals(NULL, 'currentId', $this->coverage);207 $this->assertAttributeEquals(array(), 'data', $this->coverage);208 $this->assertAttributeEquals(array(), 'tests', $this->coverage);209 }210 /**211 * @covers PHP_CodeCoverage::start212 * @covers PHP_CodeCoverage::stop213 * @covers PHP_CodeCoverage::append214 * @covers PHP_CodeCoverage::applyListsFilter215 * @covers PHP_CodeCoverage::initializeFilesThatAreSeenTheFirstTime216 * @covers PHP_CodeCoverage::applyCoversAnnotationFilter217 * @covers PHP_CodeCoverage::getTests218 */219 public function testCollect()220 {221 $coverage = $this->getCoverageForBankAccount();222 $this->assertEquals(223 $this->getExpectedDataArrayForBankAccount(), $coverage->getData()224 );225 $this->assertEquals(226 array(227 'BankAccountTest::testBalanceIsInitiallyZero' => NULL,228 'BankAccountTest::testBalanceCannotBecomeNegative' => NULL,229 'BankAccountTest::testBalanceCannotBecomeNegative2' => NULL,230 'BankAccountTest::testDepositWithdrawMoney' => NULL231 ),232 $coverage->getTests()233 );234 }235 /**236 * @covers PHP_CodeCoverage::getData237 * @covers PHP_CodeCoverage::merge238 */239 public function testMerge()240 {241 $coverage = $this->getCoverageForBankAccountForFirstTwoTests();242 $coverage->merge($this->getCoverageForBankAccountForLastTwoTests());243 $this->assertEquals(244 $this->getExpectedDataArrayForBankAccount(), $coverage->getData()245 );246 }247 /**248 * @covers PHP_CodeCoverage::getData249 * @covers PHP_CodeCoverage::merge250 */251 public function testMerge2()252 {253 $coverage = new PHP_CodeCoverage(254 $this->getMock('PHP_CodeCoverage_Driver_Xdebug'),255 new PHP_CodeCoverage_Filter256 );257 $coverage->merge($this->getCoverageForBankAccount());258 $this->assertEquals(259 $this->getExpectedDataArrayForBankAccount(), $coverage->getData()260 );261 }262 /**263 * @covers PHP_CodeCoverage::getLinesToBeCovered264 * @covers PHP_CodeCoverage::resolveCoversToReflectionObjects265 * @dataProvider getLinesToBeCoveredProvider266 */267 public function testGetLinesToBeCovered($test, $lines)268 {269 if (strpos($test, 'Namespace') === 0) {270 $expected = array(271 TEST_FILES_PATH . 'NamespaceCoveredClass.php' => $lines272 );273 }274 else if ($test === 'CoverageNoneTest') {275 $expected = array();276 }277 else if ($test === 'CoverageNothingTest') {278 $expected = false;279 }280 else if ($test === 'CoverageFunctionTest') {281 $expected = array(282 TEST_FILES_PATH . 'CoveredFunction.php' => $lines283 );284 }285 else {286 $expected = array(TEST_FILES_PATH . 'CoveredClass.php' => $lines);287 }288 $this->assertEquals(289 $expected,290 $this->getLinesToBeCovered->invoke(291 $this->coverage, $test, 'testSomething'292 )293 );294 }295 /**296 * @covers PHP_CodeCoverage::getLinesToBeCovered297 * @covers PHP_CodeCoverage::resolveCoversToReflectionObjects298 * @expectedException PHP_CodeCoverage_Exception299 */300 public function testGetLinesToBeCovered2()301 {302 $this->getLinesToBeCovered->invoke(303 $this->coverage, 'NotExistingCoveredElementTest', 'testOne'304 );305 }306 /**307 * @covers PHP_CodeCoverage::getLinesToBeCovered308 * @covers PHP_CodeCoverage::resolveCoversToReflectionObjects309 * @expectedException PHP_CodeCoverage_Exception310 */311 public function testGetLinesToBeCovered3()312 {313 $this->getLinesToBeCovered->invoke(314 $this->coverage, 'NotExistingCoveredElementTest', 'testTwo'315 );316 }317 /**318 * @covers PHP_CodeCoverage::getLinesToBeCovered319 * @covers PHP_CodeCoverage::resolveCoversToReflectionObjects320 * @expectedException PHP_CodeCoverage_Exception321 */322 public function testGetLinesToBeCovered4()323 {324 $this->getLinesToBeCovered->invoke(325 $this->coverage, 'NotExistingCoveredElementTest', 'testThree'326 );327 }328 /**329 * @covers PHP_CodeCoverage::getLinesToBeCovered330 */331 public function testGetLinesToBeCoveredSkipsNonExistantMethods()332 {333 $this->assertSame(334 array(),335 $this->getLinesToBeCovered->invoke(336 $this->coverage,337 'NotExistingCoveredElementTest',338 'methodDoesNotExist'339 )340 );341 }342 /**343 * @covers PHP_CodeCoverage::getLinesToBeCovered344 * @expectedException PHP_CodeCoverage_Exception345 */346 public function testTwoCoversDefaultClassAnnoationsAreNotAllowed()347 {348 $this->getLinesToBeCovered->invoke(349 $this->coverage,350 'CoverageTwoDefaultClassAnnotations',351 'testSomething'352 );353 }354 /**355 * @covers PHP_CodeCoverage::getLinesToBeCovered356 */357 public function testFunctionParenthesesAreAllowed()358 {359 $this->assertSame(360 array(TEST_FILES_PATH . 'CoveredFunction.php' => range(2, 4)),361 $this->getLinesToBeCovered->invoke(362 $this->coverage,363 'CoverageFunctionParenthesesTest',364 'testSomething'365 )366 );367 }368 /**369 * @covers PHP_CodeCoverage::getLinesToBeCovered370 */371 public function testFunctionParenthesesAreAllowedWithWhitespace()372 {373 $this->assertSame(374 array(TEST_FILES_PATH . 'CoveredFunction.php' => range(2, 4)),375 $this->getLinesToBeCovered->invoke(376 $this->coverage,377 'CoverageFunctionParenthesesWhitespaceTest',378 'testSomething'379 )380 );381 }382 /**383 * @covers PHP_CodeCoverage::getLinesToBeCovered384 */385 public function testMethodParenthesesAreAllowed()386 {387 $this->assertSame(388 array(TEST_FILES_PATH . 'CoveredClass.php' => range(31, 35)),389 $this->getLinesToBeCovered->invoke(390 $this->coverage,391 'CoverageMethodParenthesesTest',392 'testSomething'393 )394 );395 }396 /**397 * @covers PHP_CodeCoverage::getLinesToBeCovered398 */399 public function testMethodParenthesesAreAllowedWithWhitespace()400 {401 $this->assertSame(402 array(TEST_FILES_PATH . 'CoveredClass.php' => range(31, 35)),403 $this->getLinesToBeCovered->invoke(404 $this->coverage,405 'CoverageMethodParenthesesWhitespaceTest',406 'testSomething'407 )408 );409 }410 public function getLinesToBeCoveredProvider()411 {412 return array(413 array(414 'CoverageNoneTest',415 array()416 ),417 array(418 'CoverageClassExtendedTest',...

Full Screen

Full Screen

coverage.go

Source:coverage.go Github

copy

Full Screen

...16 "strconv"17 "android/soong/android"18)19type CoverageProperties struct {20 Native_coverage *bool21 NeedCoverageVariant bool `blueprint:"mutated"`22 NeedCoverageBuild bool `blueprint:"mutated"`23 CoverageEnabled bool `blueprint:"mutated"`24 IsCoverageVariant bool `blueprint:"mutated"`25}26type coverage struct {27 Properties CoverageProperties28 // Whether binaries containing this module need --coverage added to their ldflags29 linkCoverage bool30}31func (cov *coverage) props() []interface{} {32 return []interface{}{&cov.Properties}33}34func (cov *coverage) deps(ctx BaseModuleContext, deps Deps) Deps {35 if cov.Properties.NeedCoverageBuild {36 // Link libprofile-extras/libprofile-extras_ndk when coverage37 // variant is required. This is a no-op unless coverage is38 // actually enabled during linking, when39 // '-uinit_profile_extras' is added (in flags()) to force the40 // setup code in libprofile-extras be linked into the41 // binary/library.42 //43 // We cannot narrow it further to only the 'cov' variant since44 // the mutator hasn't run (and we don't have the 'cov' variant45 // yet).46 if !ctx.useSdk() {47 deps.LateStaticLibs = append(deps.LateStaticLibs, "libprofile-extras")48 } else {49 deps.LateStaticLibs = append(deps.LateStaticLibs, "libprofile-extras_ndk")50 }51 }52 return deps53}54func (cov *coverage) flags(ctx ModuleContext, flags Flags) Flags {55 if !ctx.DeviceConfig().NativeCoverageEnabled() {56 return flags57 }58 if cov.Properties.CoverageEnabled {59 flags.Coverage = true60 flags.GlobalFlags = append(flags.GlobalFlags, "--coverage", "-O0")61 cov.linkCoverage = true62 // Override -Wframe-larger-than and non-default optimization63 // flags that the module may use.64 flags.CFlags = append(flags.CFlags, "-Wno-frame-larger-than=", "-O0")65 }66 // Even if we don't have coverage enabled, if any of our object files were compiled67 // with coverage, then we need to add --coverage to our ldflags.68 if !cov.linkCoverage {69 if ctx.static() && !ctx.staticBinary() {70 // For static libraries, the only thing that changes our object files71 // are included whole static libraries, so check to see if any of72 // those have coverage enabled.73 ctx.VisitDirectDepsWithTag(wholeStaticDepTag, func(m android.Module) {74 if cc, ok := m.(*Module); ok && cc.coverage != nil {75 if cc.coverage.linkCoverage {76 cov.linkCoverage = true77 }78 }79 })80 } else {81 // For executables and shared libraries, we need to check all of82 // our static dependencies.83 ctx.VisitDirectDeps(func(m android.Module) {84 cc, ok := m.(*Module)85 if !ok || cc.coverage == nil {86 return87 }88 if static, ok := cc.linker.(libraryInterface); !ok || !static.static() {89 return90 }91 if cc.coverage.linkCoverage {92 cov.linkCoverage = true93 }94 })95 }96 }97 if cov.linkCoverage {98 flags.LdFlags = append(flags.LdFlags, "--coverage")99 // Force linking of constructor/setup code in libprofile-extras100 flags.LdFlags = append(flags.LdFlags, "-uinit_profile_extras")101 }102 return flags103}104func (cov *coverage) begin(ctx BaseModuleContext) {105 // Coverage is disabled globally106 if !ctx.DeviceConfig().NativeCoverageEnabled() {107 return108 }109 var needCoverageVariant bool110 var needCoverageBuild bool111 if ctx.Host() {112 // TODO(dwillemsen): because of -nodefaultlibs, we must depend on libclang_rt.profile-*.a113 // Just turn off for now.114 } else if !ctx.nativeCoverage() {115 // Native coverage is not supported for this module type.116 } else {117 // Check if Native_coverage is set to false. This property defaults to true.118 needCoverageVariant = BoolDefault(cov.Properties.Native_coverage, true)119 if sdk_version := ctx.sdkVersion(); ctx.useSdk() && sdk_version != "current" {120 // Native coverage is not supported for SDK versions < 23121 if fromApi, err := strconv.Atoi(sdk_version); err == nil && fromApi < 23 {122 needCoverageVariant = false123 }124 }125 if needCoverageVariant {126 // Coverage variant is actually built with coverage if enabled for its module path127 needCoverageBuild = ctx.DeviceConfig().CoverageEnabledForPath(ctx.ModuleDir())128 }129 }130 cov.Properties.NeedCoverageBuild = needCoverageBuild131 cov.Properties.NeedCoverageVariant = needCoverageVariant132}133func coverageMutator(mctx android.BottomUpMutatorContext) {134 if c, ok := mctx.Module().(*Module); ok && c.coverage != nil {135 needCoverageVariant := c.coverage.Properties.NeedCoverageVariant136 needCoverageBuild := c.coverage.Properties.NeedCoverageBuild137 if needCoverageVariant {138 m := mctx.CreateVariations("", "cov")139 // Setup the non-coverage version and set HideFromMake and140 // PreventInstall to true.141 m[0].(*Module).coverage.Properties.CoverageEnabled = false142 m[0].(*Module).coverage.Properties.IsCoverageVariant = false143 m[0].(*Module).Properties.HideFromMake = true144 m[0].(*Module).Properties.PreventInstall = true145 // The coverage-enabled version inherits HideFromMake,146 // PreventInstall from the original module.147 m[1].(*Module).coverage.Properties.CoverageEnabled = needCoverageBuild148 m[1].(*Module).coverage.Properties.IsCoverageVariant = true149 }150 }151}...

Full Screen

Full Screen

coverage

Using AI Code Generation

copy

Full Screen

1$coverage = new \mageekguy\atoum\reports\coverage\html();2$coverage->addWriter(new \mageekguy\atoum\writers\std\out());3$runner->addReport($coverage);4$coverageField = $coverage->addBranchCoverage();5$finder = $coverage->getBranchFinder();6$coverage->addWriter(new \mageekguy\atoum\writers\file('atoum.coverage.html'));7$coverage->addDefaultWriter();8$runner->addTestsFromDirectory('tests/units');9$script->noCodeCoverageForNamespaces('mageekguy\atoum');10$script->noCodeCoverageForNamespaces('tests\units');11$runner->run();

Full Screen

Full Screen

coverage

Using AI Code Generation

copy

Full Screen

1$coverage = new \mageekguy\atoum\reports\coverage\html();2$coverage->addWriter(new \mageekguy\atoum\writers\std\out());3$runner->addReport($coverage);4$coverage->addWriter(new \mageekguy\atoum\writers\std\out());5$runner->addReport($coverage);6$coverage->addWriter(new \mageekguy\atoum\writers\std\out());7$runner->addReport($coverage);8$coverage->addWriter(new \mageekguy\atoum\writers\std\out());9$runner->addReport($coverage);10$coverage->addWriter(new \mageekguy\atoum\writers\std\out());11$runner->addReport($coverage);12$coverage->addWriter(new \mageekguy\atoum\writers\std\out());13$runner->addReport($coverage);

Full Screen

Full Screen

coverage

Using AI Code Generation

copy

Full Screen

1$coverageField = new \mageekguy\atoum\reports\fields\runner\coverage\html('MyProject', '/path/to/destination/directory');2$script->addDefaultReport();3$runner->addReport($coverageField);4$coverageField = new \mageekguy\atoum\reports\fields\runner\coverage\html('MyProject', '/path/to/destination/directory');5$script->addDefaultReport();6$runner->addReport($coverageField);7$coverageField = new \mageekguy\atoum\reports\fields\runner\coverage\html('MyProject', '/path/to/destination/directory');8$script->addDefaultReport();9$runner->addReport($coverageField);10$coverageField = new \mageekguy\atoum\reports\fields\runner\coverage\html('MyProject', '/path/to/destination/directory');11$script->addDefaultReport();12$runner->addReport($coverageField);13$coverageField = new \mageekguy\atoum\reports\fields\runner\coverage\html('MyProject', '/path/to/destination/directory');14$script->addDefaultReport();15$runner->addReport($coverageField);16$coverageField = new \mageekguy\atoum\reports\fields\runner\coverage\html('MyProject', '/path/to/destination/directory');17$script->addDefaultReport();18$runner->addReport($coverageField);19$coverageField = new \mageekguy\atoum\reports\fields\runner\coverage\html('MyProject', '/path/to/destination/directory');

Full Screen

Full Screen

coverage

Using AI Code Generation

copy

Full Screen

1$coverage = new atoum\atoum\reports\coverage\html();2$coverage->addWriter(new atoum\atoum\writers\std\out());3$coverage->setOutPutDirectory('path/to/your/coverage');4$runner->addReport($coverage);5$coverage = new atoum\atoum\reports\coverage\html();6$coverage->addWriter(new atoum\atoum\writers\std\out());7$coverage->setOutPutDirectory('path/to/your/coverage');8$runner->addReport($coverage);9$coverage = new atoum\atoum\reports\coverage\html();10$coverage->addWriter(new atoum\atoum\writers\std\out());11$coverage->setOutPutDirectory('path/to/your/coverage');12$runner->addReport($coverage);13$coverage = new atoum\atoum\reports\coverage\html();14$coverage->addWriter(new atoum\atoum\writers\std\out());15$coverage->setOutPutDirectory('path/to/your/coverage');16$runner->addReport($coverage);17$coverage = new atoum\atoum\reports\coverage\html();18$coverage->addWriter(new atoum\atoum\writers\std\out());19$coverage->setOutPutDirectory('path/to/your/coverage');20$runner->addReport($coverage);21$coverage = new atoum\atoum\reports\coverage\html();22$coverage->addWriter(new atoum\atoum\writers\std\out());23$coverage->setOutPutDirectory('path/to/your/coverage');24$runner->addReport($coverage);25$coverage = new atoum\atoum\reports\coverage\html();26$coverage->addWriter(new

Full Screen

Full Screen

coverage

Using AI Code Generation

copy

Full Screen

1use mageekguy\atoum\reports\coverage;2use mageekguy\atoum\writers\std;3$coverageField = new coverage\html();4$coverageField->addWriter(new std\out());5$runner->addReport($coverageField);6$coverageField = new coverage\clover();7$coverageField->addWriter(new std\out());8$runner->addReport($coverageField);9$coverageField = new coverage\php();10$coverageField->addWriter(new std\out());11$runner->addReport($coverageField);12$coverageField = new coverage\text();13$coverageField->addWriter(new std\out());14$runner->addReport($coverageField);15$coverageField = new coverage\xml();16$coverageField->addWriter(new std\out());17$runner->addReport($coverageField);18$coverageField = new coverage\cobertura();19$coverageField->addWriter(new std\out());20$runner->addReport($coverageField);21$coverageField = new coverage\html();22$coverageField->addWriter(new std\out());23$runner->addReport($coverageField);24$coverageField = new coverage\html();25$coverageField->addWriter(new std\out());26$runner->addReport($coverageField);27$coverageField = new coverage\html();28$coverageField->addWriter(new std\out());29$runner->addReport($coverageField);30$coverageField = new coverage\html();31$coverageField->addWriter(new std\out());32$runner->addReport($coverageField);33$coverageField = new coverage\html();34$coverageField->addWriter(new std\out());35$runner->addReport($coverageField);36$coverageField = new coverage\html();37$coverageField->addWriter(new std

Full Screen

Full Screen

coverage

Using AI Code Generation

copy

Full Screen

1$coverageField = new \mageekguy\atoum\report\fields\runner\coverage\html('MyProject', '/path/to/coverage/');2$script->addDefaultReport();3$runner->addReport($coverageField);4$coverageField = new \mageekguy\atoum\report\fields\runner\coverage\html('MyProject', '/path/to/coverage/');5$script->addDefaultReport();6$runner->addReport($coverageField);7$coverageField = new \mageekguy\atoum\report\fields\runner\coverage\html('MyProject', '/path/to/coverage/');8$script->addDefaultReport();9$runner->addReport($coverageField);10$coverageField = new \mageekguy\atoum\report\fields\runner\coverage\html('MyProject', '/path/to/coverage/');

Full Screen

Full Screen

coverage

Using AI Code Generation

copy

Full Screen

1require_once 'atoum\classes\coverage.php';2require_once 'atoum\classes\coverage.php';3require_once 'atoum\classes\coverage.php';4require_once 'atoum\classes\coverage.php';5require_once 'atoum\classes\coverage.php';6require_once 'atoum\classes\coverage.php';7require_once 'atoum\classes\coverage.php';8require_once 'atoum\classes\coverage.php';9require_once 'atoum\classes\coverage.php';10require_once 'atoum\classes\coverage.php';11require_once 'atoum\classes\coverage.php';12require_once 'atoum\classes\coverage.php';13require_once 'atoum\classes\coverage.php';14require_once 'atoum\classes\coverage.php';15require_once 'atoum\classes\coverage.php';16require_once 'atoum\classes\coverage.php';17require_once 'atoum\classes\coverage.php';

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Atoum automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used methods in coverage

Run Selenium Automation Tests on LambdaTest Cloud Grid

Trigger Selenium automation tests on a cloud-based Grid of 3000+ real browsers and operating systems.

Test now for Free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful