1
0
mirror of https://github.com/golang/go synced 2024-10-04 11:11:21 -06:00
Commit Graph

712 Commits

Author SHA1 Message Date
Rob Pike
6d30efc772 add a type testing.T and use it in tests.
update uses of gotest.
minor tweak to testing structure for protobuf.

R=rsc
DELTA=276  (71 added, 75 deleted, 130 changed)
OCL=19614
CL=19621
2008-11-19 14:38:05 -08:00
Robert Griesemer
165d78717d - adjust sort.go to use new naming conventions
R=rsc
DELTA=31  (0 added, 0 deleted, 31 changed)
OCL=19618
CL=19620
2008-11-19 14:32:15 -08:00
Russ Cox
10002bb0fb accept empty list of package imports.
R=ken
OCL=19617
CL=19617
2008-11-19 14:27:48 -08:00
Robert Griesemer
93dcc2c248 new Makefile generated by gobuild
R=rsc
DELTA=9  (7 added, 0 deleted, 2 changed)
OCL=19613
CL=19613
2008-11-19 14:24:53 -08:00
Russ Cox
63a84348cc look for .6 before .a; accept archives with 0 length __.SYMDEF
TBR=r
OCL=19612
CL=19612
2008-11-19 14:21:44 -08:00
Robert Griesemer
b548e73460 - array lib (essentially vector, more complete)
- TODO replace vector

R=r
DELTA=314  (313 added, 0 deleted, 1 changed)
OCL=19592
CL=19609
2008-11-19 14:05:21 -08:00
Russ Cox
aa1ede15cc avoid problem overwriting read-only quietgcc
TBR=r
OCL=19600
CL=19600
2008-11-19 13:01:32 -08:00
Russ Cox
d2dfd76b3d build with warnings enabled.
new script "quietgcc" installed in $HOME/bin during make.bash
	runs gcc with warnings, turns off inappropriate ones,
	greps out useless output.

quietgcc also makes sure to run the correct 64-bit gcc.

R=r
DELTA=38  (36 added, 0 deleted, 2 changed)
OCL=17493
CL=19599
2008-11-19 12:54:44 -08:00
Russ Cox
87b1124407 gobuild: add coverage rule, ignore files in package main.
R=r
DELTA=55  (41 added, 11 deleted, 3 changed)
OCL=19594
CL=19598
2008-11-19 12:52:30 -08:00
Russ Cox
692a5dbb9e coverage tweaks
* handle new 6g shift sequence
* assume 6.out

R=r
DELTA=24  (20 added, 0 deleted, 4 changed)
OCL=19593
CL=19596
2008-11-19 12:51:25 -08:00
Russ Cox
cf9b7f7534 essentially 100% coverage of strconv in tests.
fix a few bugs.

R=r
DELTA=294  (275 added, 9 deleted, 10 changed)
OCL=19595
CL=19595
2008-11-19 12:50:34 -08:00
Rob Pike
572cad8719 gotest, via testing.go, should warn you if you failed to create any tests.
when chatty, it should tell you how many there are.

R=rsc
DELTA=5  (5 added, 0 deleted, 0 changed)
OCL=19590
CL=19590
2008-11-19 11:50:58 -08:00
Robert Griesemer
60ee27d96c saving 2 lines :-)
R=rsc
DELTA=5  (0 added, 2 deleted, 3 changed)
OCL=19562
CL=19585
2008-11-19 10:20:52 -08:00
Russ Cox
9a6fd41a01 silence gcc warnings: missing prototypes and unused variables
R=ken
OCL=19583
CL=19583
2008-11-19 09:49:06 -08:00
Russ Cox
f1547e511b leave 6.out around after gotest;
delete it in make clean.

R=r
DELTA=10  (0 added, 0 deleted, 10 changed)
OCL=19542
CL=19581
2008-11-19 09:40:54 -08:00
Russ Cox
9b8a6dc7da change array slice error to include bounds
$ 6.out
slice[5:12] of [10] array
throw: array slice
SIGSEGV: segmentation violation

R=r
DELTA=15  (13 added, 0 deleted, 2 changed)
OCL=19540
CL=19580
2008-11-19 09:35:36 -08:00
Rob Pike
addd6fa846 read and write never return -1 now: error return is through the error variable only
R=rsc
DELTA=13  (9 added, 0 deleted, 4 changed)
OCL=19538
CL=19570
2008-11-18 22:32:01 -08:00
Ken Thompson
497e648e7e perm is [] instead of map
R=r
OCL=19569
CL=19569
2008-11-18 19:59:56 -08:00
Ken Thompson
b2b4e7fa55 need ./ on local files
R=rsc
OCL=19567
CL=19567
2008-11-18 19:36:36 -08:00
Ken Thompson
64718ec262 oops
R=r
OCL=19566
CL=19566
2008-11-18 19:27:15 -08:00
Ken Thompson
2dd16a3208 first cut at optimizing
R=r
OCL=19564
CL=19564
2008-11-18 19:24:37 -08:00
Russ Cox
9dc4b1ca90 make Copyn take and return int64.
add Copy.

R=gri
DELTA=52  (37 added, 1 deleted, 14 changed)
OCL=19557
CL=19559
2008-11-18 18:45:51 -08:00
Robert Griesemer
79d94d504f Copyn
R=rsc
DELTA=34  (34 added, 0 deleted, 0 changed)
OCL=19541
CL=19545
2008-11-18 18:08:05 -08:00
Russ Cox
23bd1298f7 add -chatty flag to test.
was supposed to be in some other cl but got dropped.

R=r
DELTA=21  (16 added, 2 deleted, 3 changed)
OCL=19531
CL=19539
2008-11-18 17:52:05 -08:00
Russ Cox
c5f4867ffa stop flag reading before lone - arg.
R=r
DELTA=5  (3 added, 0 deleted, 2 changed)
OCL=19520
CL=19529
2008-11-18 17:23:11 -08:00
Russ Cox
866c08ff20 fix build for newbies
R=r
OCL=19526
CL=19528
2008-11-18 17:22:31 -08:00
Ken Thompson
93c8d3c41b another shift bug
R=r
OCL=19525
CL=19525
2008-11-18 17:15:42 -08:00
Russ Cox
92a4fe1dd5 more tests for strconv; convert to gotest.
R=r
DELTA=219  (186 added, 32 deleted, 1 changed)
OCL=19508
CL=19523
2008-11-18 17:12:14 -08:00
Russ Cox
6cc001c312 return *os.Error instead of bool from strconv.ato*
R=r
DELTA=137  (56 added, 4 deleted, 77 changed)
OCL=19505
CL=19522
2008-11-18 17:12:07 -08:00
Russ Cox
360151d4e2 gobuild changes.
* handles multiple packages per directory
	* scans directory for files if given no arguments
	* infers package name
	* includes test rule invoking gotest

R=r
DELTA=746  (444 added, 150 deleted, 152 changed)
OCL=19504
CL=19521
2008-11-18 17:11:56 -08:00
Russ Cox
c1efd7d6e5 roll tests into one binary
R=r
DELTA=145  (27 added, 27 deleted, 91 changed)
OCL=19423
CL=19502
2008-11-18 16:13:25 -08:00
Rob Pike
7969860126 testing support library
R=rsc
OCL=19496
CL=19496
2008-11-18 15:29:10 -08:00
Rob Pike
8b8630c6cf allow files to be named on the command line
R=rsc
DELTA=3  (1 added, 1 deleted, 1 changed)
OCL=19485
CL=19485
2008-11-18 14:17:13 -08:00
Rob Pike
d495372509 new gotest shell script (will be a proper command some day, probably)
automates construction and execution of unit tests.

R=rsc
DELTA=60  (58 added, 0 deleted, 2 changed)
OCL=19482
CL=19484
2008-11-18 14:12:14 -08:00
Russ Cox
6b7dd4c020 add build step to install debuggers setgid procmod.
they have to go in /usr/local/bin
because the setgid bit is ignored in /Users.

R=r
DELTA=54  (49 added, 0 deleted, 5 changed)
OCL=19424
CL=19463
2008-11-18 10:08:46 -08:00
Russ Cox
4656686cf5 use correct lineno in nod even if yacc has looked ahead.
makes lineno correct for statements without semicolons.

R=ken
OCL=19454
CL=19454
2008-11-18 09:32:05 -08:00
Russ Cox
ed628ca79b * faster atof for common cases
(gets 3x speedup in go; got 40x in c)
* handle and test overflow

R=r
DELTA=217  (200 added, 0 deleted, 17 changed)
OCL=19399
CL=19422
2008-11-17 17:22:51 -08:00
Russ Cox
4d1d5e8a88 work around more commonly-unreachable 6g code sequences.
R=r
DELTA=23  (23 added, 0 deleted, 0 changed)
OCL=19405
CL=19420
2008-11-17 17:16:50 -08:00
Russ Cox
3f548cd2d9 add gobuild to build
R=r
DELTA=2  (0 added, 0 deleted, 2 changed)
OCL=19404
CL=19415
2008-11-17 16:59:04 -08:00
Russ Cox
a1585b676b fix the easy parts of bug120
R=r,ken
DELTA=66  (52 added, 3 deleted, 11 changed)
OCL=19386
CL=19389
2008-11-17 13:58:45 -08:00
Ken Thompson
b7f01f9f41 silence compiler warning
R=r
OCL=19382
CL=19382
2008-11-17 12:55:22 -08:00
Russ Cox
079c00a475 correctly rounded floating-point conversions
in new package strconv.

move atoi etc to strconv too.

update fmt, etc to use strconv.

R=r
DELTA=2232  (1691 added, 424 deleted, 117 changed)
OCL=19286
CL=19380
2008-11-17 12:34:03 -08:00
Russ Cox
75647d2024 First pieces of malloc.
R=r
DELTA=756  (754 added, 0 deleted, 2 changed)
OCL=19266
CL=19378
2008-11-17 12:32:35 -08:00
Russ Cox
5aa7dc5daf adopt suggestions from Bentley and McIlroy (SP&E Nov 1993)
to make qsort more robust:

	* use "ninther" to choose pivot.
	* use three-way partition to avoid quadratic
 	  behavior on all-one-value arrays.

also add tests suggested in that paper.

the immediate cause of the slowness we observed was
in fact none of these: the recursive call was sorting
data[0:m] instead of data[a:m].

also rename package to "sort" to match convention.

R=r,gri
DELTA=358  (255 added, 21 deleted, 82 changed)
OCL=19341
CL=19373
2008-11-17 11:51:34 -08:00
Ken Thompson
2567c073ea random permutation function
func perm(n int) *map[int]int

R=r
OCL=19340
CL=19340
2008-11-16 13:02:47 -08:00
Russ Cox
9c7b064043 fix bugs in package locals
R=ken
OCL=19299
CL=19299
2008-11-14 17:31:29 -08:00
Rob Pike
fd47cb9af5 conflicting scopes should cause error exit
TBR=rsc
OCL=19297
CL=19297
2008-11-14 17:28:11 -08:00
Russ Cox
d3f6093931 package-local declarations using keyword "package".
R=r
DELTA=129  (81 added, 0 deleted, 48 changed)
OCL=19283
CL=19291
2008-11-14 16:35:08 -08:00
Ken Thompson
e875055461 switch
R=r
OCL=19288
CL=19288
2008-11-14 16:24:27 -08:00
Robert Griesemer
23c8faaf85 buf fix: make FD.Read, FD.Write work for empty buffers
R=r
DELTA=8  (6 added, 0 deleted, 2 changed)
OCL=19273
CL=19275
2008-11-14 15:13:29 -08:00
Rob Pike
f3e354ec26 clean up make script
reorder pieces so io is earlier

R=rsc
DELTA=66  (27 added, 24 deleted, 15 changed)
OCL=19248
CL=19255
2008-11-14 12:53:44 -08:00
Robert Griesemer
0c4c842eb0 - added Init() function so that vectors can be used w/o New():
var v Vector.Vector;
  	v.Init();
	...
- clear vector elements in Reset
- removed some comments that seem redundant

R=r
DELTA=16  (9 added, 5 deleted, 2 changed)
OCL=19247
CL=19247
2008-11-14 11:22:39 -08:00
Russ Cox
f8b20e4083 add cov, prof to default build; clean up compiler warnings
R=r
DELTA=8  (1 added, 0 deleted, 7 changed)
OCL=19245
CL=19245
2008-11-14 10:57:48 -08:00
Russ Cox
7832ab5ba0 code coverage tool
$ 6cov -g 235.go 6.out
	235.go:62,62 main·main 0x27c9-0x2829 MOVL	$main·.stringo(SB),AX
	235.go:30,30 main·main 0x2856-0x285e ADDQ	$6c0,SP
	$

and assorted fixes.

R=r
DELTA=743  (732 added, 8 deleted, 3 changed)
OCL=19226
CL=19243
2008-11-14 10:45:23 -08:00
Rob Pike
2355395550 handle nils safely
R=rsc
DELTA=38  (14 added, 10 deleted, 14 changed)
OCL=19242
CL=19242
2008-11-14 10:42:45 -08:00
Robert Griesemer
3c2f0ae132 * pretty printing snapshot: towards printing comments nicely
- implemented elastic tabstops algorithm, now correct and documented
- first cut at printing comments (use -comments flag, disabled for now)
- struct field types are now aligned (using elastic tab stops)
- needs more fine-tuning

* fixed a bug in test script
* added quick smoke test to makefile and invoke it in run.bash
  instead of the full test

R=r
OCL=19220
CL=19220
2008-11-13 17:50:46 -08:00
Rob Pike
e2621b8037 add a %v format to print an arbitrary value in its "println" form.
also add code to print (pointers to) arrays, through %v.

R=rsc
DELTA=108  (70 added, 33 deleted, 5 changed)
OCL=19184
CL=19192
2008-11-13 15:20:52 -08:00
Russ Cox
e4f4ab0b8d more array methods
R=r
OCL=19172
CL=19172
2008-11-13 13:42:59 -08:00
Russ Cox
c5f21c0dc2 * 6l:
if an object in an archive tries to refer
	to a file in its original source directory,
	ignore it.

* 6ar:
	fix bug if archive is empty.

* gobuild:
	build archive in current directory.

* math:
	use new gobuild Makefile.

* test/math.go:
	rename to mathest.go, add // run line, make it run.

R=r
DELTA=494  (277 added, 203 deleted, 14 changed)
OCL=19090
CL=19171
2008-11-13 13:42:26 -08:00
Ken Thompson
9795c9e727 temp fix for map not multiple of 8
R=r
OCL=19166
CL=19166
2008-11-13 13:20:18 -08:00
Ken Thompson
bc0b4f0d2a mike's map code
R=r
OCL=19146
CL=19146
2008-11-13 10:35:44 -08:00
Rob Pike
419e1e05a1 add some support for modifying what pointers point to
R=rsc
DELTA=27  (16 added, 11 deleted, 0 changed)
OCL=19130
CL=19132
2008-11-12 19:05:05 -08:00
Rob Pike
6e70c2c74f fix bug in FullyReader
R=rsc
DELTA=1  (0 added, 0 deleted, 1 changed)
OCL=19131
CL=19131
2008-11-12 19:04:56 -08:00
Rob Pike
b1d37b74d9 reflect.PtrValue.SetSub() to set pointers
R=rsc
OCL=19101
CL=19101
2008-11-12 14:19:39 -08:00
Rob Pike
2f4d35ffb9 converting uint bits back into floats
R=rsc
DELTA=32  (32 added, 0 deleted, 0 changed)
OCL=19084
CL=19091
2008-11-12 11:51:34 -08:00
Robert Griesemer
2727abe4fc - lowercased package name (Bignum -> bignum)
- implemented some missing functionality (and, or, xor of positive ints)

R=r
OCL=19087
CL=19087
2008-11-12 11:00:11 -08:00
Ken Thompson
902a4d5f29 6c bug with large constants
R=r
OCL=19056
CL=19056
2008-11-11 18:15:36 -08:00
Rob Pike
6ee7fe5808 Implement a "full reader" wrapper for io.Read, guaranteeing that
either the buffer is full, zero bytes were read, or an error is returned.

R=rsc
DELTA=44  (42 added, 0 deleted, 2 changed)
OCL=19027
CL=19047
2008-11-11 17:28:36 -08:00
Russ Cox
b682f924d7 don't try interface/structure conversion until
last resort, because it assumes every call is a
real use of the conversion.

R=ken
OCL=19026
CL=19026
2008-11-11 15:55:32 -08:00
Russ Cox
792145723e width fixes.
* check for uncomputed struct offsets
* distinguish function structs from ordinary structs
* make sure function structs are not examined in isolation

R=ken
OCL=19005
CL=19005
2008-11-11 13:46:55 -08:00
Rob Pike
0e544fa0e3 fix error-handling bug.
add newline after stack traces.

R=rsc
DELTA=3  (2 added, 1 deleted, 0 changed)
OCL=18945
CL=18953
2008-11-10 18:13:20 -08:00
Russ Cox
600ee088b6 * accept all NaNs, not just the one sys.NaN() returns.
* use union, not cast, to convert between uint64 and float64,
  to avoid possible problems with gcc in future.

R=r
DELTA=75  (39 added, 15 deleted, 21 changed)
OCL=18926
CL=18926
2008-11-10 15:17:56 -08:00
Russ Cox
e8766354a4 handle Inf, NaN in float print
R=r
DELTA=48  (23 added, 14 deleted, 11 changed)
OCL=18707
CL=18922
2008-11-10 14:54:10 -08:00
Rob Pike
842e1a9aa7 Add a cache to avoid unnecessary parsing of type strings when constructing values
R=rsc
DELTA=12  (9 added, 0 deleted, 3 changed)
OCL=18916
CL=18921
2008-11-10 14:53:40 -08:00
Rob Pike
10137e7f1d fix start/stop bug in prof.
also only time-limit if a value is provided.

R=rsc
DELTA=9  (4 added, 2 deleted, 3 changed)
OCL=18917
CL=18920
2008-11-10 14:53:32 -08:00
Rob Pike
091fb779a1 Protocol buffer encoding.
R=rsc
DELTA=1075  (1028 added, 31 deleted, 16 changed)
OCL=18865
CL=18918
2008-11-10 14:47:28 -08:00
Robert Griesemer
176e256b26 Added missing Set method for Vector
BUG=1474670
TBR=r
DELTA=6  (6 added, 0 deleted, 0 changed)
OCL=18839
CL=18843
2008-11-07 18:31:50 -08:00
Rob Pike
4328d44254 wrong system call number for stat
TBR=rsc
OCL=18833
CL=18833
2008-11-07 16:17:42 -08:00
Ken Thompson
79f5697b02 byte multiply
R=r
OCL=18830
CL=18830
2008-11-07 16:05:17 -08:00
Ken Thompson
dc78c64f23 byte multiply
R=r
OCL=18807
CL=18807
2008-11-07 14:20:32 -08:00
Ken Thompson
9b827cf9a0 bug in select default
R=r
OCL=18741
CL=18741
2008-11-06 17:50:28 -08:00
Robert Griesemer
483e031525 - binomial implementation (fixing broken build)
R=r
OCL=18738
CL=18738
2008-11-06 17:29:07 -08:00
Rob Pike
175dd773e6 simpleminded ascii to floating point conversion
R=rsc
DELTA=111  (107 added, 0 deleted, 4 changed)
OCL=18720
CL=18725
2008-11-06 16:32:28 -08:00
Rob Pike
335a5236e7 add sys.float32bits, sys.float64bits
R=rsc
DELTA=21  (21 added, 0 deleted, 0 changed)
OCL=18709
CL=18718
2008-11-06 15:48:36 -08:00
Russ Cox
ec81145565 s/gins/gbranch/
R=ken
OCL=18713
CL=18713
2008-11-06 15:05:19 -08:00
Russ Cox
0eda21a2fd change minimum sethi/ullman number to 1
to distinguish not computed (0) vs trivial (1).

add missing ullmancalc on function args.

R=ken
OCL=18711
CL=18711
2008-11-06 14:50:58 -08:00
Russ Cox
9906bfc7bb 6g ninit fixes - fixes the two test cases
i isolated last night.  does not fix rob's
interface-smashing bug.

R=ken
OCL=18698
CL=18698
2008-11-06 13:31:13 -08:00
Robert Griesemer
66c6b13b03 - implemented String() and Format functionality in Bignum
- added a test

R=r
OCL=18687
CL=18687
2008-11-06 12:13:52 -08:00
Robert Griesemer
3a2c0a9615 - fixes to sprintf (by rob)
R=r
OCL=18685
CL=18685
2008-11-06 11:56:08 -08:00
Rob Pike
91212bd1ad If a value implements String(), use that in fmt.print (not fmt.printf)
R=rsc
DELTA=13  (9 added, 0 deleted, 4 changed)
OCL=18682
CL=18684
2008-11-06 11:38:44 -08:00
Rob Pike
f15dfa7802 Polymorphic printing.
R=rsc
DELTA=100  (70 added, 10 deleted, 20 changed)
OCL=18663
CL=18669
2008-11-06 10:40:57 -08:00
Ken Thompson
79fbbe37a7 select default
R=r
OCL=18646
CL=18646
2008-11-05 21:50:28 -08:00
Russ Cox
a6af484328 more runtime support for chan select default
R=ken
OCL=18630
CL=18630
2008-11-05 18:04:24 -08:00
Russ Cox
b69e80d8dd runtime support for default in select.
assumes cas->send == 2 for default case.

R=ken
OCL=18628
CL=18628
2008-11-05 17:57:18 -08:00
Russ Cox
d6a7cefd1e allow any type at all in sys.unreflect;
accomodate empty type table in 6l.

R=r
DELTA=10  (2 added, 8 deleted, 0 changed)
OCL=18601
CL=18605
2008-11-05 16:09:12 -08:00
Russ Cox
553c98dca4 fix renamed-package bug in exported names:
always show original name

R=ken
OCL=18603
CL=18603
2008-11-05 15:59:34 -08:00
Ken Thompson
83a798513c more on t,ok = I.(T)
R=r
OCL=18599
CL=18599
2008-11-05 15:33:01 -08:00
Ken Thompson
a8b56a73a4 T,ok = I.(T)
R=r
OCL=18580
CL=18582
2008-11-05 14:27:07 -08:00
Russ Cox
6f07ec721a new interface error messages
package main
	func main() {
		var i interface { } = 1;
		a := i.(*[]byte);
	}

interface { } is int, not *[]uint8
throw: interface conversion

	package main
	func main() {
		var i interface { };
		a := i.(*[]byte);
	}

interface is nil, not *[]uint8
throw: interface conversion

	package main
	func main() {
		i := sys.unreflect(0, "*bogus");
		a := i.(*[]byte);
	}

interface { } is *bogus, not *[]uint8
throw: interface conversion

R=r
DELTA=30  (24 added, 2 deleted, 4 changed)
OCL=18548
CL=18565
2008-11-05 13:05:01 -08:00
Rob Pike
5a1cbe8b64 trim tags from type strings for structure fields.
R=rsc
DELTA=28  (14 added, 4 deleted, 10 changed)
OCL=18561
CL=18563
2008-11-05 13:01:33 -08:00